我有一个小问题。我想用curl加载这个页面'http://www.facebook.com/feeds/page.php?id=57084011597 & format = rss20'。这里是我尝试使用的代码,坚果我不能从它回来的东西。卷发请求失败
$head=array('Accept'=>'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Charset'=>'ISO-8859-2,utf-8;q=0.7,*;q=0.3',
'Accept-Encoding'=>'gzip,deflate,sdch',
'Accept-Language'=>'ro-RO,ro;q=0.8,en-US;q=0.6,en;q=0.4',
'Cache-Control'=>'max-age=0',
'Connection'=>'keep-alive',
'Cookie'=>'datr=hroHTi2NZk2KleOaswb03Q_Q; lu=gg9lJcPeInHt6hnut7bviqQg; locale=en_US; e=n; L=2; c_user=100000596376783; sct=1309129360; xs=2%3Ad05dd80e364608525dd664ad73f6483f; act=1309410851554%2F5; presence=EM309410852L4N0_5dEp_5f1B00596376783F1X309410852168Y0Z11G309410768PCC',
'Host'=>'www.facebook.com',
'User-Agent'=>$_SERVER['HTTP_USER_AGENT']);
$url='http://www.facebook.com/feeds/page.php?id=57084011597&format=rss20';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_HTTPHEADER,$head);
$result = curl_exec($ch);
return $result;
我试过了没有设置标题,但它也没有奏效。 希望有人给我提供线索。
谢谢!
'curl_error()'说什么? –
是的,你得到的卷曲错误或PHP错误是什么? –
为什么你需要这个页面的标题?它已经是一个RSS源,我认为设置这些标题不会有太大的区别,对吧? –