[Zope] Http API Ping

Chris Withers chrisw@nipltd.com
Wed, 10 Oct 2001 17:29:14 +0100


Brendon Grunewald wrote:
> 
> I need to ping an external url, but do not want the customer to click a
> submit button or something similar. i.e. if a certain page is viewed, I want
> to ping an HTTP API on another server in the following format:
> "http://www.sp.com/api/@param=abc". Depending on the parameter sent to them,
> I either need to store the result returned or ignore it and carry on
> regardless.

Hmmm, try an external method something alogn the lines of:

import urllib

def ping(self):
   return urllib.urlopen('http://www.sp.com/api/@param=abc').read()

...lemme know if it works :-)

cheers,

Chris