I want to send some parameters from a python script on my server to a php script on my server using HTTP. Suggestions?
A:
This is pretty easy using urllib
:
import urllib
myurl = 'http://localhost/script.php?var1=foo&var2=bar'
# GET is the default action
response = urllib.urlopen(myurl)
# Output from the GET assuming response code was 200
data = response.read()
jathanism
2010-10-08 16:00:11
Cheers! Given that the same thing could, in a sense, be achieved using stdin or argument passing, what is the relative overhead?
2010-10-08 18:08:45
I have no idea, but since you're using Python you can make the script accept use dynamic variables and don't need to resort to system (cli) calls for it.
jathanism
2010-10-08 18:20:09