从代理服务器cURL内容


cURL contents from Proxy Servers

大家好,

我有一个脚本在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);

如有任何建议,不胜感激。

谢谢!

URL应为:$ URL =" http://www.canadaproxy.net/includes/process.php?action=update";

添加
curl_setopt($ch,CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt($ch,CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_POSTFIELDS, "u=google.com");

,它会起作用