Dear Zopistas, Quick Question: 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. This is similar to the way counters work, but I would prefer not using Javascripts. Is there a zope solution. <dtml-call ...> does not seem to work for external urls. Any assistance much appreciated... Regards, Brendon --- Brendon Grunewald www.70South.com: - Interactive and updated daily with the latest news and information on Antarctica and related topics. - Available on your PC, Mobile Phone and PDA. - The No.1 source for Antarcticles (tm)
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
[Chris Withers]
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 :-)
Oh, that kind of thing works well, but you have to handle failure conditions and time-outs in case the server isn't working or something. Also, you might not want everything to stop while you are waiting or the response. Cheers, Tom P
participants (3)
-
Brendon Grunewald -
Chris Withers -
Thomas B. Passin