在使用file_get_contents方法来获取远程文件时会出现

[function.file-get-contents]: failed to open stream: HTTP request failed!

错误

解决方法是:修改php.ini 中的allow_url_fopen = On 这样可以解决部分人的问题,

完美的解决方案还得修改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)"

模拟浏览器就可以了;

php file_get_contents失败[function.file-get-contents]: failed to open stream: HTTP request failed!解决的更多相关文章

  1. 完美解决failed to open stream: HTTP request failed!(file_get_contents引起的)

    当使用php5自带的file_get_contents方法来获取远程文件的时候,有时候会出现file_get_contents(): failed to open stream: HTTP reque ...

  2. failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found

    failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found 一.总结 一句话总结:这里出现的问题是我在博客园删除了一篇文章,时 ...

  3. failed to open stream: HTTP request failed! HTTP/1.1 505 HTTP Version Not Supported

    PHP模拟GET请求支付宝退款链接(未用sdk  自己拼接的请求链接与参数); 起初用file_get_contents();就报错 :failed to open stream: HTTP requ ...

  4. file_get_contents failed to open stream: HTTP request failed(一个字符决定成败)

    file_get_contents 开始成功了.后来不知怎么的就报错,调试半天没发现什么问题. 结果.里面多了一个"空格"就报错.去掉空格就好了,你们仔细找找吧.

  5. failed to open stream :HTTP request failed 解决方法

    用curl抓取,不要用file_get_contents(); 前者比后者效率高一点

  6. file_get_contents HTTP request failed! Internal Server Error

    使用file_get_contents报错 Severity: WarningMessage: file_get_contents(http://geetest.com:8000/select?gid ...

  7. 报错:OpenCV Error: Assertion failed (src.size() == dst.size() && src.type() == dst.ty pe()) in unknown function, file ..……

    在用cvDilate函数的时候,老是导致程序中断,报错如下: OpenCV Error: Assertion failed (src.size() == dst.size() && s ...

  8. file get contents 访问不了域名原因

    file get contents('域名'); 居然不好用 后来发现 etc/hosts 127.0.0.1  www.baidu.com  这样的 #127.0.0.1  www.baidu.co ...

  9. Warning: require(D:\wamp\www\glink-smart\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in D:\wamp\www\glink-smart\bootstrap\autoload.php on line 1

    Laravel访问出错错误信息:`Warning: require(/vendor/autoload.php): failed to open stream: No such file or dire ...

随机推荐

  1. 注解学习(模仿springMvc的注解注入方式)

    最近在看springMvc的源码,看到了该框架的注入注解的部分觉的有点吃力,可能还是对注解的方面的知识还认识的不够深刻,所以特意去学习注解方面的知识.由于本人也是抱着学习的态度来阅读源码,若文章在表述 ...

  2. C# WebService URL重写

    背景 有时候我们会有这样的需求,将 WebService URL 中的 asmx 后缀去掉:或者我们要模拟普通 Web 的 URL,接口名称直接拼接在 URL 中.这些情况我们都要用到URL重写. 关 ...

  3. [转]ASP.NET MVC 3 Razor + jqGrid 示例

    本文转自:http://www.cnblogs.com/think8848/archive/2011/07/15/2107828.html 前些天写了一篇有关jqGrid的文章,因为是公司项目的原因一 ...

  4. plain framework 1 版本更新 1.0.2 增加打包插件

    由于个别因素,该框架的文档没有及时的更新到博客上,但是离线的文档已经完成.本次更新对框架来说显得比较重要,因为在文档的编写过程中经过再次的阅读代码修复了不少错误,最主要的是统一了整个框架的标准风格.对 ...

  5. Pairs Forming LCM(素因子分解)

    http://acm.hust.edu.cn/vjudge/contest/view.action?cid=109329#problem/B    全题在文末. 题意:在a,b中(a,b<=n) ...

  6. input file美化,文件上传

    此文学习至:http://www.haorooms.com/post/input_file_leixing 然而只会用,不会做,UI泪茫茫 效果图: 原图: 美化后: 此主要用css美化表单,然后用J ...

  7. C# 文件下载四方法

    using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Secu ...

  8. webpack webpack-dev-server使用指南

    webpack-dev-server插件可以实现webpack的自动编译刷新 项目结构 pockage.js { "name": "webpack", &quo ...

  9. Linux的chattr与lsattr命令

    有时候你发现用root权限都不能修改某个文件,大部分原因是曾经用chattr命令锁定该文件了.chattr命令的作用很大,其中一些功能是由Linux内核版本来支持的,不过现在生产绝大部分跑的linux ...

  10. 重构Web Api程序(Api Controller和Entity) 续篇(1)

    经过一系列重构,你眼明的话,还是可以看到还有重构的地方,如: string newFileName = "~/Temp/" + Guid.NewGuid().ToString() ...