完美解决failed to open stream: HTTP request failed!
来源:互联网 发布:产品网络营销策划方案 编辑:程序博客网 时间:2024/05/17 06:53
当使用php5自带的file_get_contents方法来获取远程文件的时候(在我的自动化测试框架中有类似调用需求),有时候会出现file_get_contents(): failed to open stream: HTTP request failed!这个警告信息。
解决的方法都是修改php.ini,把allow_url_fopen给启用,改成 allow_url_fopen = On
这样做可以解决某些人的问题,有人说在php.ini中,有这样两个选项:allow_url_fopen =on(表示可以通过url打开远程文件),user_agent="PHP"(表示通过哪种脚本访问网络,默认前面有个 " ; " 去掉即可。)重启服务器。
但是有些还是会有这个警告信息,想用完美的解决还差一步,还得设置php.ini里面的user_agent,php默认的user_agent是 PHP,我们把它改成Mozilla/4.0 (compatible; MSIE 6.0;Windows NT 5.0)来模拟浏览器就可以了,user_agent=”Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)”
- 完美解决failed to open stream: HTTP request failed!
- 完美解决failed to open stream: HTTP request failed!
- 【分享】完美解决failed to open stream: HTTP request failed!
- 完美解决failed to open stream: HTTP request failed!(file_get_contents引起的)
- 完美解决failed to open stream: HTTP request failed!(file_get_contents引起的)
- 解决failed to open stream: HTTP request failed!
- failed to open stream: HTTP request failed!
- php错误:failed to open stream: HTTP request failed!
- php错误提示failed to open stream: HTTP request failed!
- PHP解决[function.file-get-contents]: failed to open stream: HTTP request failed!
- 解决:PHP file_get_contents函数failed to open stream: HTTP request failed!错误
- failed to open stream: HTTP request failed! HTTP/1.1 505 HTTP Version Not Supported in
- php file_get_contents()报错 failed to open stream: HTTP request failed!、Internal Server Error
- failed to open stream解决办法
- PHP failed to open stream: Permission denied
- [function.fopen]: failed to open stream
- failed to open stream: Permission denied in
- fopen: failed to open stream: Permission de
- GUI剖析之 获取屏保控制窗口显示模式的实现(屏保应用)
- 2012 SCI收录期刊及影响因子(3/10)
- Qt 4.8.3 中资源文件找不到的错误
- 新华时代公司简介
- 高级程序员装逼指南
- 完美解决failed to open stream: HTTP request failed!
- SpringMVC+Spring+Hibernate整合
- GUI 剖析之播放器 实例2) 全功能播放器
- HR 故事-应聘和竞聘
- java标签之表格的隔行间色显示
- 挂载SD卡
- 2012 SCI收录期刊及影响因子(4/10)
- Android开发者指南(6) —— AIDL
- 管理心理学