wechatpay-apiv3 / wechatpay-guzzle-middleware

微信支付 APIv3 Guzzle HTTP Client中间件(middleware)
Apache License 2.0
208 stars 46 forks source link

不能调用服务商接口吗?报:cURL error 52: Empty reply from server #37

Closed fengerwoo closed 3 years ago

fengerwoo commented 3 years ago

调用接口:https://api.mch.weixin.qq.com/applyment/micro/getstate

文档地址:https://pay.weixin.qq.com/wiki/doc/api/xiaowei.php?chapter=19_3

cURL error 52: Empty reply from server (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)
fengerwoo commented 3 years ago

好像更新新接口了,但是调用也是 400 Bad Request

调用接口:https://api.mch.weixin.qq.com/v3/applyment4sub/applyment/ 文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/tool/applyment4sub/chapter3_1.shtml

fengerwoo commented 3 years ago

http_errors设置是否为:false

不然调试接口的时候,抛出400,500的header错误,哪里出问题都不知道

$resp = $client->request('GET', 'https://api.mch.weixin.qq.com/v3/...', [ // 注意替换为实际URL
        'headers' => [ 'Accept' => 'application/json' ],
        "http_errors" => false, // <--- http_errors 设置为false
    ]);