开发者

Connection Timeout With File_get_contents()

I am working on a script t开发者_如何学JAVAhat fetches csv files from a web server. I am using file_get_contents presently. Sometimes i get the message

Warning: file_get_contents failed to open stream: Connection timed out

I assume it can be due to website being down. Or can there be a situation where the website is fine but still this warning shows up. Also what advantage does CURL provide over this function.


this is because the remote url is having 404 error.


For accessing remote files, you should use cURL. You can set cURL to timeout quietly if the remote server takes too long.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜