tags:

views:

41

answers:

1

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
Cheers! Given that the same thing could, in a sense, be achieved using stdin or argument passing, what is the relative overhead?
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