我想使用 HTTP 将一些参数从我服务器上的 python 脚本发送到我服务器上的 php 脚本。有什么建议吗?
最佳答案
这很容易使用 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()
关于php - Python:如何在内部/localhost 发出 HTTP 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3889283/