======================= 代码中存在的Exception===============================
* Trying 58.251.117.190...
* TCP_NODELAY set
* Connected to api.mch.weixin.qq.com (58.251.117.190) port 443 (#0)
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use http/1.1
* Server certificate:
* subject: C=CN; ST=Guangdong Province; L=Shenzhen; O=Tenpay Technology Company Limited; CN=payapp.weixin.qq.com
* start date: Sep 21 00:00:00 2022 GMT
* expire date: Oct 21 23:59:59 2023 GMT
* subjectAltName: host "api.mch.weixin.qq.com" matched cert's "*.mch.weixin.qq.com"
* issuer: C=US; O=DigiCert Inc; CN=DigiCert Secure Site CN CA G3
* SSL certificate verify ok.
> GET /v3/pay/transactions/native HTTP/1.1
Host: api.mch.weixin.qq.com
Accept: application/json, text/plain, application/x-gzip, application/pdf, image/png, image/*;q=0.5
Content-Type: application/json; charset=utf-8
User-Agent: wechatpay-php/1.4.8 GuzzleHttp/7 curl/7.61.1 (Linux/4.18.0-305.3.1.el8.x86_64) PHP/7.4.22
Authorization: WECHATPAY2-SHA256-RSA2048 mchid="xxxxxx",serial_no="xxxxxx",timestamp="1689249484",nonce_str="EyPsSmisWfO1e9HD0CsKb1hKA11J6s16",signature="dmkfTRc+OaY1F9g6Uu6AXkuuGheLC8X3whew0gaVeey9Dx5nCIqb07zLis3RJJVrFFMYsNxTB70Rk399X+S9GITyEv78J1OHn7B4ptk3112djOHxriAsxvpoRtEP6dAidCaAvqNqEZEGkibkNylimz6ZOEoqTwdbwjYMjiL2QJCuJ8vQfNkJZzAwOOw7mNjxbW1dOjPLkwK9bnwBfEkNSwupRi4sGCDZ+TDPF0LqN62aeLJcoUvLlIOeBNqwNnZ6QRmwQkvWpTp1Pi7zUumlZ/P1dRRrYjAWTOpBvnUs4Fu6H/8XoPPRhb1BfopcvvV05Iin/SlF8VbN5vAi6ckl/w=="
< HTTP/1.1 405 Method Not Allowed
< Server: nginx
< Date: Thu, 13 Jul 2023 11:58:04 GMT
< Content-Length: 0
< Connection: keep-alive
< Keep-Alive: timeout=8
<
* Connectio #0 to host api.mch.weixin.qq.com left intact
GuzzleHttp\Exception\ClientException Object
(
....
[message:protected] => Client error: `GET https://api.mch.weixin.qq.com/v3/pay/transactions/native` resulted in a `405 Method Not Allowed` response
[string:Exception:private] =>
[code:protected] => 405
[file:protected] => /data/wwwroot/fastdz/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php
[line:protected] => 113
采用网格检查工具, 有如下信息
[root@FASTDZ01 wxpaymonitor]# ./wxpaymonitor -t
=======================
MchId : 1647502941
Flag : 1689251369044928865
Version : 2.1.0
=======================
start to http trace ...
Url: https://api.mch.weixin.qq.com/pay/orderquery
RemoteIp: [1/0]
Total duration: 122.399988ms
Lookup duration: 595.415µs
Connect duration: 7.085709ms
App Connect duration: 39.627918ms
Request duration: 75.043106ms
--
Send duration: 60.436µs
Waiting duration: 74.946409ms
Transfer duration: 36.261µs
=======================
UserIp: 120.79.132.25
LocalDns:
=======================
dial ip4:icmp: missing address
read ip4 172.20.56.191->14.215.140.116: i/o timeout
read ip4 172.20.56.191->183.232.95.110: i/o timeout
read ip4 172.20.56.191->183.3.235.18: i/o timeout
read ip4 172.20.56.191->220.249.243.200: i/o timeout
read ip4 172.20.56.191->163.177.89.203: i/o timeout
read ip4 172.20.56.191->111.13.34.104: i/o timeout
read ip4 172.20.56.191->123.151.71.149: i/o timeout
read ip4 172.20.56.191->123.126.122.46: i/o timeout
read ip4 172.20.56.191->182.254.22.146: i/o timeout
read ip4 172.20.56.191->203.205.254.189: i/o timeout
WXPAY_IP TIME(ms)
112.60.13.218 4.924ms
101.91.0.140 30.499ms
210.22.240.140 31.412ms
121.51.58.151 32.693ms
220.196.148.13 32.824ms
101.226.137.13 33.072ms
183.195.236.140 33.637ms
121.51.50.140 34.653ms
183.192.199.139 35.616ms
123.151.79.109 37.238ms
182.254.50.109 37.821ms
121.51.30.154 39.320ms
125.39.133.115 40.027ms
121.51.29.161 45.925ms
111.30.144.109 46.837ms
170.106.134.203 172.543ms
203.205.234.247 353.681ms
14.215.140.116 9999.999ms
123.151.71.149 9999.999ms
182.254.22.146 9999.999ms
111.13.34.104 9999.999ms
220.249.243.200 9999.999ms
163.177.89.203 9999.999ms
123.126.122.46 9999.999ms
183.232.95.110 9999.999ms
203.205.254.189 9999.999ms
183.3.235.18 9999.999ms
9999.999ms
[root@FASTDZ01 wxpaymonitor]# ping api.mch.weixin.qq.com
PING forwardtmp.weixin.qq.com (58.251.117.190) 56(84) bytes of data.
64 bytes from reverse.gdsz.cncnet.net (58.251.117.190): icmp_seq=1 ttl=51 time=7.08 ms
64 bytes from reverse.gdsz.cncnet.net (58.251.117.190): icmp_seq=2 ttl=51 time=7.08 ms
64 bytes from reverse.gdsz.cncnet.net (58.251.117.190): icmp_seq=3 ttl=51 time=7.08 ms
64 bytes from reverse.gdsz.cncnet.net (58.251.117.190): icmp_seq=4 ttl=51 time=7.08 ms
^C
--- forwardtmp.weixin.qq.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 7.076/7.078/7.082/0.059 ms
[root@FASTDZ01 wxpaymonitor]# ping api.mch.weixin.qq.com
PING forwardtmp.weixin.qq.com (58.251.117.190) 56(84) bytes of data.
64 bytes from reverse.gdsz.cncnet.net (58.251.117.190): icmp_seq=1 ttl=51 time=7.08 ms
64 bytes from reverse.gdsz.cncnet.net (58.251.117.190): icmp_seq=2 ttl=51 time=7.08 ms
64 bytes from reverse.gdsz.cncnet.net (58.251.117.190): icmp_seq=3 ttl=51 time=7.08 ms
64 bytes from reverse.gdsz.cncnet.net (58.251.117.190): icmp_seq=4 ttl=51 time=7.08 ms
^C
--- forwardtmp.weixin.qq.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 7.076/7.078/7.082/0.059 ms
[root@FASTDZ01 wxpaymonitor]# nslookup api.mch.weixin.qq.com
Server: 100.100.2.136
Address: 100.100.2.136#53
Non-authoritative answer:
api.mch.weixin.qq.com canonical name = forward.weixin.qq.com.
forward.weixin.qq.com canonical name = forwardtmp.weixin.qq.com.
Name: forwardtmp.weixin.qq.com
Address: 58.251.117.190
Name: forwardtmp.weixin.qq.com
Address: 157.255.174.121
Name: forwardtmp.weixin.qq.com
Address: 240e:e1:a900:50::4a
Name: forwardtmp.weixin.qq.com
Address: 240e:e1:a900:50::49
下单接口都是post,你怎么弄个get
而其他地址没有报405错误:
https://api.mch.weixin.qq.com/v3/bill/tradebill
商户那里也加了白名单,没有用。真搞不明白为啥弄个支付这么难