我试图用file_get_contents()
抢Twitter的饲料,但是我得到以下警告:file_get_contents()函数未能打开流:
failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request
我的代码:
$feed = 'http://twitter.com/statuses/user_timeline.rss?screen_name=google&count=6';
$tweets = file_get_contents($feed);
我只是为了测试而使用Google。 allow_url_fopen
已在我的php.ini
文件中启用。
任何想法可能是错误的?
它也更容易调试了很多,因为你可以得到它的转储请求并将其发送头(畸形请求是HTTP 400错误的常见原因) – 2010-08-21 01:49:34
http://stackoverflow.com/questions/ 555523/file-get-contents-vs-curl-what-has-better-performance – 2010-08-21 02:02:41
是的,大约快4-5倍。 – 2010-08-21 02:12:23