我的Python腳本是:調用PHP與子
base_url = "http://server.com/sync.php?"
phone_url = "phone=%s" % "12345678"
pass_url = "pass=%s" % "xxxxxxxxx"
verif_url = "u=%s" % "12345678"
url = base_url + "%s&%s&%s" % (phone_url,pass_url,verif_url)
req = urllib.urlopen(url)
the_page = req.read()
的URL看起來像:http://server.com/sync.php?phone=123456781&pass=xxxxxxxxx&u=12345678
工作正常,但它的速度很慢...
所以我嘗試使用子過程:
proc = subprocess.Popen("php ./sync.php", "shell=True, stdout=subprocess.PIPE)
script_response = proc.stdout.read()
如何發送參數? (電話,通,U)
我的PHP文件的內容:
$username = $_GET["phone"];
$password = $_GET["pass"];
$u = $_GET["u"];
好了,所以我爲例CMD = 「PHP」, 「./sync.php」,%phone_url「&通過=%s的「%pass_url」&u =%s「%verif_url]? –
從終端執行的確切命令行是什麼? – daouzli
我不知道從終端,但從我的瀏覽器:http://server.com/sync.php?phone=123456781&pass=xxxxxxxxx&u=12345678 –