开发者

Connection Timeout With File_get_contents()

开发者 https://www.devze.com 2023-02-05 15:54 出处:网络
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

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

精彩评论

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