2013-04-07 85 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

回答