我只是用file_get_contents()
擺脫這樣的用戶的最新微博:的file_get_contents拋出400錯誤請求錯誤PHP
$tweet = json_decode(file_get_contents('http://api.twitter.com/1/statuses/user_timeline/User.json'));
這工作在我的本地正常,但當我把它上傳到我的服務器時,它引發此錯誤:
Warning: file_get_contents(http://api.twitter.com/1/statuses/user_timeline/User.json) [function.file-get-contents]:failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request...
不知道什麼可能導致它,也許一個PHP配置我需要我的服務器上設置?
在此先感謝!
閱讀:http://stackoverflow.com/questions/697472/file-get-contents-returning-failed-to-open-stream-http-request-failed –
請參見[這堆問題] [1],因爲它可能會回答你的問題。 [1]:http://stackoverflow.com/questions/3710147/php-get-content-of-http-400-response –
感謝彼得·布魯克斯!這工作! – javiervd