早上代码突然报错:cURL error 18: transfer closed with outstanding read data remaining (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
部分人会有这个报错,分析了代码,是这部分人进入其他业务代码之前,会请求一个别的组的接口,于是对该接口清醒了如下操作:
步骤
-
确认接口没问题
本地用postman测试没问题 -
确认服务器能访问目标ip,且端口开放
确认服务器能访问目标ip,在服务器输入ping 目标ip
有返回,说明不是这个问题
确认端口开放,在服务器输入telnet 目标ip 端口号
能有返回,不是这个问题
-
代码请求的时候请求头是否有问题
在找到过程中发现是Guzzle调用的接口,在这里找到了解决方案,在header里面加上'accept-encoding' => 'gzip, deflate',
就可以了!