我在我的网站http://searchisback.com上有一个php脚本,用于从用户的公共页面检索一些文本。这个用来抓取我的Facebook页面的代码不再那么做了。任何想法为什么?file_get_contents停止工作
$url = "http://facebook.com/michael.morgenstern";
$options = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: en\r\n" .
"Cookie: foo=bar\r\n" .
"User-Agent: Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.102011-10-16 20:23:10\r\n" // i.e. An iPad
)
);
$context = stream_context_create($options);
$file = @file_get_contents($url, false, $context);
echo $file;
谢谢!
迈克尔
刮痧脸书是反对他们的托管(除非你有他们的表达事先书面同意) - 所以你一直在做错,即使它在“工作”。你需要使用API。 – CBroe