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 ...
随机推荐
- 关于原型链,原来这么简单?—————终结__proto__和prototype的那些事
今天,一个技术群里小朋友提出一个问题: Object.prototype.a = function () { console.log('a') } Function.prototype.b = fun ...
- vue elementui 切换语言
1.安装插件:npm install vue-i18n --save 2.src下新建i18n文件夹, i18n文件夹下创建langs文件夹和i18n.js文件 langs文件夹下创建cn.js; ...
- spring.jar是包含有完整发布的单个jar 包,spring.jar中包含除了spring-mock.jar里所包含的内容外其它所有jar包的内容,因为只有在开发环境下才会用到 spring-mock.jar来进行辅助测试,正式应用系统中是用不得这些类的。
Spring jar包的描述:针对3.2.2以上版本 org.springframework spring-aop ——Spring的面向切面编程,提供AOP(面向切面编程)实现 org.spring ...
- python基础操作---string
#coding:utf-8 var1 = 'Hello World!' print var1[::] print len(var1) print var1[0:len(var1)] print var ...
- vb6中word编程总结
1,在project\references 中加入microsoft word 9.0 object library 2, 启动word Dim wApp As Word.Application ...
- 10年前文章_respin 下制作iso 文件的脚本说明
1.prepare_spin.sh 用于在 /var/rpm 下生成 lhs-local 需要的repositery 2.respin.sh 使用revisor 生成 iso 3. post_spi ...
- bzoj1367 [Baltic2004]sequence 左偏树+贪心
题目传送门 https://lydsy.com/JudgeOnline/problem.php?id=1367 题解 先考虑条件为要求不下降序列(不是递增)的情况. 那么考虑一段数值相同的子段,这一段 ...
- 【JavaScript】DOM之BOM
BOM 1.BOM是什么 提供了独立页面内容,与浏览器相关的一系列对象,管理窗口之间通信 2.Window对象 具有双重角色,对象即是允许JS访问浏览器窗口的一个对象,和ECMAScript规范中的G ...
- flask中自定义日志类
一:项目架构 二:自定义日志类 1. 建立log.conf的配置文件 log.conf [log] LOG_PATH = /log/ LOG_NAME = info.log 2. 定义日志类 LogC ...
- Ubuntu操作
1. 从windows 拷贝文件到Ubuntu: scp /c/Users/init/Downloads/pycharm-community-2019.3.tar.gz alice@192 ...