我寫了一個cURL腳本,但是如何檢查它是否正常工作並在訪問網站時正確傳遞?PHP cURl:我可以檢查我的用戶代理是否在工作嗎?
$ckfile = '/tmp/cookies.txt';
$useragent= "Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0_1 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Mobile/7A400";
$ch = curl_init ("http://website.com");
curl_setopt($ch, CURLOPT_AUTOREFERER , true);
=> true
curl_setopt($ch, CURLOPT_USERAGENT, $useragent); // set user agent
curl_setopt ($ch, CURLOPT_COOKIEJAR, $ckfile);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
$output = curl_exec ($ch);
curl_close($ch);
Thanks Rage!是我的私人憤怒與你聯繫的方式嗎? – Strawberry 2009-11-24 08:45:05
@Doug:對? -------------------------- – RageZ 2009-11-24 09:00:07
想要問你更多關於cURL的信息,但是如果你不想要的話可以。 – Strawberry 2009-11-24 09:02:52