2013-04-07 81 views
0

我想寫一個非常簡單的PHP腳本來測試主機api.twitter.com是否已啓動。但是當我做php的file_get_contents失敗,但ping工程

file_get_contents('https://api.twitter.com') 

然後我得到的錯誤

Warning: file_get_contents(https://api.twitter.com): 
failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found 

簡單ping在命令行中工作正常,並file_get_contents正常工作的其他網址,如http://google.com

之前我給curl試試我以爲我會看到如果我做錯了file_get_contents()

+5

拷貝到您的瀏覽器的URL https://api.twitter.com:這真的是一個404. – darma 2013-04-07 08:54:01

+0

怎麼樣才能確定呢? – mulllhausen 2013-04-07 08:56:00

+0

Ping是ICMP,HTTP是TCP。 – Gumbo 2013-04-07 08:56:55

回答