Python: how to make HTTP request internally/localhost
I want to send some paramete开发者_如何学JAVArs from a python script on my server to a php script on my server using HTTP. Suggestions?
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()
精彩评论