2013-05-14 65 views
0

我試圖創建一個簡單的腳本,它將檢索最後5進了一個Twitter用戶(在這種情況下,英國廣播公司)的file_get_contents()「未能打開流」錯誤檢索鳴叫

這沒關係運行在本地上我的開發服務器,但一旦我上傳這活的網站,我收到以下錯誤:

Warning: file_get_contents(https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=bbc&count=5): failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request in .... 

有誰知道爲什麼這不我活的服務器上運行(而精我dev的服務器?)

回答

1

正如file_get_contents throws 400 Bad Request error PHP中提到的那樣,使用curl inst file_get_contents的ead由於改進了錯誤處理 - 這可能會爲您提供另一個線索。

+0

歡呼@celtis會給你一個去:) – Zabs 2013-05-14 13:02:53

+0

我試過這個,但只是得到一個NULL的返回值。有任何想法嗎? http://phpfiddle.org/main/code/uuw-b5c – Zabs 2013-05-14 13:14:56

+0

首先,突出的是,您在'user_timeline.json'和'include_entities = true'之間缺少_?_。 – Celtis 2013-05-14 13:23:23

相關問題