Showing
1 changed file
with
6 additions
and
1 deletions
@@ -533,6 +533,11 @@ class WxPayApi | @@ -533,6 +533,11 @@ class WxPayApi | ||
533 | private static function postXmlCurl($xml, $url, $useCert = false, $second = 30) | 533 | private static function postXmlCurl($xml, $url, $useCert = false, $second = 30) |
534 | { | 534 | { |
535 | $ch = curl_init(); | 535 | $ch = curl_init(); |
536 | + //设置curl默认访问为IPv4 | ||
537 | + if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) { | ||
538 | + curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); | ||
539 | + } | ||
540 | + | ||
536 | //设置超时 | 541 | //设置超时 |
537 | curl_setopt($ch, CURLOPT_TIMEOUT, $second); | 542 | curl_setopt($ch, CURLOPT_TIMEOUT, $second); |
538 | 543 | ||
@@ -548,7 +553,7 @@ class WxPayApi | @@ -548,7 +553,7 @@ class WxPayApi | ||
548 | curl_setopt($ch, CURLOPT_HEADER, FALSE); | 553 | curl_setopt($ch, CURLOPT_HEADER, FALSE); |
549 | //要求结果为字符串且输出到屏幕上 | 554 | //要求结果为字符串且输出到屏幕上 |
550 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); | 555 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); |
551 | - | 556 | + |
552 | if ($useCert == true) { | 557 | if ($useCert == true) { |
553 | //设置证书 | 558 | //设置证书 |
554 | //使用证书:cert 与 key 分别属于两个.pem文件 | 559 | //使用证书:cert 与 key 分别属于两个.pem文件 |
-
Please register or login to post a comment