Hi fellow zope hackers! I'm building a site for someone who wants to have the entire site within zope, to connect to dbs, etc... But they use a service that requires them to post form data to a master server. Is there an easy way (in dtml or python) to do this without seeing the data transfer or ending up at th other server's pages? So far I've considered making an external method that uses lynx and dumps the return data. Is this the best way? Thanks for the help! -ed- -- Green Graphics ::: Print and Web Design ::: 510.923.0000
Unless the other server returns to a page on your site, the only thing you can probably do is to use and external method that uses something like wget/lynx to post the data and get somthing back to be parsed by the method. hth AM Ed Colmar wrote:
Hi fellow zope hackers!
I'm building a site for someone who wants to have the entire site within zope, to connect to dbs, etc... But they use a service that requires them to post form data to a master server.
Is there an easy way (in dtml or python) to do this without seeing the data transfer or ending up at th other server's pages?
So far I've considered making an external method that uses lynx and dumps the return data. Is this the best way?
Thanks for the help!
-ed-
-- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
Hi AM and zope cru! Here is the quick external method I built to do this... If anyone is familiar with urllib and can tell me if I need to do something different I'd appreciate it! def formsender(self, completeurl): """ This method is used to transparently send form data to an external server completeurl is the entire url including form field values.""" import urllib result = urllib.URLopener().open(completeurl) urllib.URLopener().close() On Wed, 5 Mar 2003, AM wrote:
Unless the other server returns to a page on your site, the only thing you can probably do is to use and external method that uses something like wget/lynx to post the data and get somthing back to be parsed by the method.
hth AM
Ed Colmar wrote:
Hi fellow zope hackers!
I'm building a site for someone who wants to have the entire site within zope, to connect to dbs, etc... But they use a service that requires them to post form data to a master server.
Is there an easy way (in dtml or python) to do this without seeing the data transfer or ending up at th other server's pages?
So far I've considered making an external method that uses lynx and dumps the return data. Is this the best way?
Thanks for the help!
-ed-
-- Green Graphics ::: Print and Web Design ::: 510.923.0000
Ed Colmar wrote:
Hi AM and zope cru!
Here is the quick external method I built to do this...
If anyone is familiar with urllib and can tell me if I need to do something different I'd appreciate it!
def formsender(self, completeurl): """ This method is used to transparently send form data to an external server
completeurl is the entire url including form field values.""" import urllib result = urllib.URLopener().open(completeurl) urllib.URLopener().close()
I suppose this should work. I generally just use fd = urllib.urlopen(<url>) fd.close() In both cases you can send the form data as another set of arguments to the open method. So does it do what you want?? AM -- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
Just a warning about urllib and Zope from previous experience. If you're not sure of the reliability of the server that will be receiving your urllib requests, be cautious. We used urllib to hit another server and experienced really bad hanging and timeout problems. The external methods would start hanging and eventually slow Zope to a crawl or a stop. There's a timeoutsocket module for Python that lets you set a timeout on a request that's probably worth using even if you do trust the other server not to time out on you--you never know what network factors will work against you! It's at http://www.timo-tasi.org/python/timeoutsocket.py -- Chris On Thursday, March 6, 2003, at 02:08 AM, Ed Colmar wrote:
Hi AM and zope cru!
Here is the quick external method I built to do this...
If anyone is familiar with urllib and can tell me if I need to do something different I'd appreciate it!
def formsender(self, completeurl): """ This method is used to transparently send form data to an external server
completeurl is the entire url including form field values.""" import urllib result = urllib.URLopener().open(completeurl) urllib.URLopener().close()
On Wed, 5 Mar 2003, AM wrote:
Unless the other server returns to a page on your site, the only thing you can probably do is to use and external method that uses something like wget/lynx to post the data and get somthing back to be parsed by the method.
hth AM
Ed Colmar wrote:
Hi fellow zope hackers!
I'm building a site for someone who wants to have the entire site within zope, to connect to dbs, etc... But they use a service that requires them to post form data to a master server.
Is there an easy way (in dtml or python) to do this without seeing the data transfer or ending up at th other server's pages?
So far I've considered making an external method that uses lynx and dumps the return data. Is this the best way?
Thanks for the help!
-ed-
-- Green Graphics ::: Print and Web Design ::: 510.923.0000
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
On Thursday 06 March 2003 09:12, Ed Colmar wrote:
Hi fellow zope hackers!
I'm building a site for someone who wants to have the entire site within zope, to connect to dbs, etc... But they use a service that requires them to post form data to a master server.
Is there an easy way (in dtml or python) to do this without seeing the data transfer or ending up at th other server's pages?
So far I've considered making an external method that uses lynx and dumps the return data. Is this the best way?
have a look at KebasData http://www.zope.org/Members/kedai/KebasData KebasData grabs data from any accessable url, and you can define ways to parse the data returned. you can use either GET or POST method. i also make use of timeoutsocket.py, to help limit the "hang" if there's any trouble with the other site. note that the timeout affects all of zope .. so, take care when setting the timeout. (the default is 15s) i know get method works great, but has done little test with post method if you'd like to give it a shot, and report success/failure? hth
Thanks for the help!
-ed-
I use something like the following to do the exact a same thing... import string, urllib from M2Crypto import m2urllib encodedParams = urllib.urlencode(params) url = m2urllib.FancyURLopener() u =url.open('https://secure.post/location',encodedParams) data = u.read() In an external method ... I use m2crypto because of good SSL support ... You could probably use the regular httplib if you don't need SSL support. On Wed, 2003-03-05 at 19:12, Ed Colmar wrote:
Hi fellow zope hackers!
I'm building a site for someone who wants to have the entire site within zope, to connect to dbs, etc... But they use a service that requires them to post form data to a master server.
Is there an easy way (in dtml or python) to do this without seeing the data transfer or ending up at th other server's pages?
So far I've considered making an external method that uses lynx and dumps the return data. Is this the best way?
Thanks for the help!
-ed- -- Edward Muller
Interlix - President Web Hosting - PC Service & Support Custom Programming - Network Service & Support Phone: 417-862-0573 Cell: 417-844-2435 Fax: 417-862-0572 http://www.interlix.com
participants (5)
-
AM -
Bakhtiar A Hamid -
Chris Muldrow -
Ed Colmar -
Edward Muller