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 request failed! HTTP/1.1 505 HTTP Version Not Supported!!!
换成 curl模拟get 请求 返回值为空 没错 直接没报错 返回空字符串,,,以为curl参数设置不对,各种试到怀疑人生
接着继续 获取 $info = curl_getinfo($ch); 查看信息
发现 http_code 为 505 ,查到说是 不支持 HTTP/1.1的有(此处肯定不是该原因) 也有说请求格式不对 要 去除空格的
直接 对URL preg_replace('# #','',$url) 再请求
接着 支付宝 又返回时间参数格式有错 也就是 yyy-MM-dd HH:mm:ss 中间的空格还不能没有
看到一篇文章 解决了该问题 : https://blog.csdn.net/bianb123/article/details/81557300
preg_replace('# #','%20',$url);
再回头 无论 file_get_contents(); 还是curl 都可成功请求, 期待已久的
"code":"10000","msg":"Success"
终于出来了
特此记录!
failed to open stream: HTTP request failed! HTTP/1.1 505 HTTP Version Not Supported的更多相关文章
- php file_get_contents失败[function.file-get-contents]: failed to open stream: HTTP request failed!解决
在使用file_get_contents方法来获取远程文件时会出现 [function.file-get-contents]: failed to open stream: HTTP request ...
- 完美解决failed to open stream: HTTP request failed!(file_get_contents引起的)
当使用php5自带的file_get_contents方法来获取远程文件的时候,有时候会出现file_get_contents(): failed to open stream: HTTP reque ...
- 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 一.总结 一句话总结:这里出现的问题是我在博客园删除了一篇文章,时 ...
- file_get_contents failed to open stream: HTTP request failed(一个字符决定成败)
file_get_contents 开始成功了.后来不知怎么的就报错,调试半天没发现什么问题. 结果.里面多了一个"空格"就报错.去掉空格就好了,你们仔细找找吧.
- failed to open stream :HTTP request failed 解决方法
用curl抓取,不要用file_get_contents(); 前者比后者效率高一点
- file_get_contents HTTP request failed! Internal Server Error
使用file_get_contents报错 Severity: WarningMessage: file_get_contents(http://geetest.com:8000/select?gid ...
- 上传文件出错:org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. Stream ended unexpectedly
最近做一个web项目中有上传文件的功能,已经写出并在本地和部署到服务器上测试了好几个文件上传都没问题(我用的是tomcat).后来又上传了一个700多K的文件(前边的都是不足600K的,并且这个wor ...
- file_put_contents 错误:failed to open stream: Invalid argument 一种原因
今天在测试nilcms系统的时候,出现了一个报错,导致缓存无法更新: file_put_contents(C:\UPUPW_AP5.4\vhosts\d.tv\NilCMS_APP\include_r ...
- Warning: file_put_contents(data.txt): failed to open stream: Permission denied in /Library/WebServer/Documents/test.php on line 22
最近在学习PHP 在保存文件的时候报Warning: file_put_contents(data.txt): failed to open stream: Permission denied in ...
随机推荐
- lldb调试命令
XCode4.0以后,编译器换成了LLVM 编译器 2.0 与以前相比,更加强大:1.LLVM 编译器是下一带开源的编译技术.完全支持C, Objective-C, 和 C++.2.LLVM 速度比 ...
- First one Day(哈哈哈哈)
今天是我来到园子的第一天,后序会分享一些自己所学的知识(当然我知道没人看,但是我自己看就好).哈哈哈哈哈 请大家多多关照!
- 安装运行redis
在Linux系统上安装Redis 环境准备 Redis是C语言开发,建议在Linux上运行,本人系统centos-6.5. 安装redis需要先将官网下载的源码进行编译,编译依赖gcc环境,如果没有g ...
- 计蒜客 蓝桥模拟 I. 天上的星星
计算二维前缀和,节省时间.容斥定理. 代码: #include <cstdio> #include <cstdlib> #include <cstring> #in ...
- 磁盘,fdisk分区,MBR,dd命令
光盘和磁盘.u盘.软盘.硬盘有什么区别 ①光盘: cdrom/dvdrom:光驱(光盘驱动器) rom:只读 ram:可以擦写 cd:700M dvd:4G ②软盘:flopp ...
- 4--面试总结-promise
promise异步原理: 定义:promise是异步编程的解决方案,可以解决异步回调地狱的问题: 原理:三种状态两种结果的一个状态机:三种状态(pending,fulfilled,rejected)两 ...
- Tomcat与jdk在Linux上的安装与配置
本人qq群也有许多的技术文档,希望可以为你提供一些帮助(非技术的勿加). QQ群: 281442983 (点击链接加入群:http://jq.qq.com/?_wv=1027&k=29Lo ...
- 在父组件中,传值给子组件-vue
1.通过 props <x-test :name="username"></x-test>1)props为字符串数组 props: ['name']2)pr ...
- Python_019(六星级别之反射方法)
1.反射 1)神赐给你的内置函数 : a: getattr(命名空间,'函数名') == 命名空间.属性名; 这里的命名空间指的是对象或者类; b: getattr四个应用场景: 1)类名.名字 &l ...
- 小程序封装wx.request,以及调用
1.新建一个api目录,与pages同级 2.在api目录下新建一个api.js文件 3.编写代码 const host = 'http://test.test.cn' const wxRequest ...