棘手的问题 file/fopen/file_get_contents/函数HTTP request failed丢包(无法获取远程URL内容)
找到了好长时间.. 在一个老外的站上找到了2个方法.不过没效.问题依旧.
If the error still happen and the PHP scripts still unable to connect to remote external servers and thus unable to download updates or retrieve files, check the user_agent setting in PHP.ini.
By default php.ini set the user_agent to “PHP” which signifies that it’s the script that try to access the web server. Some web servers will refuse and don’t allow script to access and receive the date from the server. So, by setting the user_agent to that of a web browser, PHP will let the web server know which kind of web browser will receive the date, and thus able to open the HTTP connection stream.
The user_agent can be set to any kind of browser strings, for example of Internet Explorer:
user_agent=”Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)”大概意思就是改PHP.INI 配置文件将user_agent 设置为 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)然后又看到一个老兄这样的解决办法 呼呼…PHP代码 估计还不如用CURL库 或者
socket$i=0;