美好的一天,來自代理服務器的cURL內容
我有一個PHP腳本,它從URL獲取內容。我爲此使用了cURL。但是,我想從代理服務器獲取內容,例如http://www.canadaproxy.net/,並且腳本似乎沒有返回值。
這裏是我的PHP代碼:
$url = "http://www.canadaproxy.net/browse.php?u=Oi8vd3d3Lmdvb2dsZS5jYS8%3D&b=5";
$timeout = 5;
$useragent = "Googlebot/2.1 (http://www.googlebot.com/bot.html)";
$ch = curl_init();
curl_setopt ($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$raw = curl_exec($ch);
curl_close($ch);
var_dump($raw);
任何建議將不勝感激。
謝謝!
它的工作!非常感謝你! – acidpaul