即使请求成功,PHP curl_errno也返回7

时间:2020-09-11 23:34:22

标签: php curl authorize.net php-curl

我正在尝试使用官方的PHP SDK v2.0.0集成authorize.net(AIM),并且看到一些奇怪的行为:

  1. curl_exec()返回false,即使请求成功并且CURLOPT_RETURNTRANSFER设置为true
  2. curl_errno对于同一请求返回7(无法将connect()连接到主机或代理)。

我知道请求成功,因为:

  1. 我可以看到该交易已成功记录在authorize.net上
  2. CURLOPT_RETURNTRANSFER设置为false导致打印来自authorize.net的JSON响应
  3. curl_getinfo()显示HTTP状态码= 200

有人通过cURL经历过这种行为吗?我不确定我缺少什么。

编辑:添加了设置为CURLOPT_VERBOSE的输出

*   Trying 198.241.206.22:443...
* Connected to apitest.authorize.net (198.241.206.22) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /home/app/demo/assets/lib/anet_sdk_2.0.0/lib/ssl/cert.pem
  CApath: none
* SSL connection using TLSv1.2 / AES256-GCM-SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: C=US; ST=California; L=Foster City; O=Authorize.Net; CN=*.authorize.net
*  start date: Feb  5 20:44:08 2020 GMT
*  expire date: Mar 15 21:14:08 2021 GMT
*  subjectAltName: host "apitest.authorize.net" matched cert's "*.authorize.net"
*  issuer: C=US; O=Entrust, Inc.; OU=See www.entrust.net/legal-terms; OU=(c) 2012 Entrust, Inc. - for authorized use only; CN=Entrust Certification Authority - L1K
*  SSL certificate verify ok.
> POST /xml/v1/request.api HTTP/1.1
Host: apitest.authorize.net
Accept: */*
Content-Type: text/json
Content-Length: 1458

* upload completely sent off: 1458 out of 1458 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Cache-Control: no-store
< Pragma: no-cache
< Content-Type: application/json; charset=utf-8
< X-OPNET-Transaction-Trace: a2_fe4a070f-cf07-47d7-8e9e-c8a703920de5-5628-7089051
< Access-Control-Allow-Credentials: true
< Access-Control-Allow-Headers: x-requested-with,cache-control,content-type,origin,method,SOAPAction
< Access-Control-Allow-Methods: PUT,OPTIONS,POST,GET
< Access-Control-Allow-Origin: *
< Strict-Transport-Security: max-age=31536000
< X-Cnection: close
< Date: Sat, 12 Sep 2020 10:40:48 GMT
< Content-Length: 512
<
* Connection #0 to host apitest.authorize.net left intact

0 个答案:

没有答案