paypal 支付问题 - V2EX-最新主题
V2EX-最新主题rivercherdeeeeee:
这是封装的方法:
private function _connectByCURL($url, $body, $http_header = false, $identify = false){
$ch = @curl_init(); if (!$ch) { $this->_logs[] = $this->paypal->l('Connect failed with CURL method'); } else { $this->_logs[] = $this->paypal->l('Connect with CURL method successful'); $this->_logs[] = ''.$this->paypal->l('Sending this params:').''; $this->_logs[] = $body; for ($attempt = 0; $attempt < 3; $attempt++) { @curl_setopt($ch, CURLOPT_URL, 'https://' . $url); if ($identify) { @curl_setopt($ch, CURLOPT_USERPWD, Configuration::get('PAYPAL_LOGIN_CLIENT_ID') . ':' . Configuration::get('PAYPAL_LOGIN_SECRET')); } @curl_setopt($ch, CURLOPT_POST, true); if ($body) { @curl_setopt($ch, CURLOPT_POSTFIELDS, $body); } @curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); @curl_setopt($ch, CURLOPT_HEADER, false); @curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20); @curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); @curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); //@curl_setopt($ch, CURLOPT_SSLVERSION, Configuration::get('PAYPAL_VERSION_TLS_CHECKED') == '1.2' ? 6 : 1); @curl_setopt($ch, CURLOPT_VERBOSE, false); if ($http_header) { @curl_setopt($ch, CURLOPT_HTTPHEADER, $http_header); } $result = @curl_exec($ch); if (!$result) { $this->_logs[] = $this->paypal->l('Send with CURL method failed ! Error:').' '.curl_error($ch); if (curl_errno($ch)) { die(var_dump(curl_error($ch))); $this->_logPaypal(curl_error($ch)); } sleep(1); } else { $this->_logs[] = $this->paypal->l('Send with CURL method successful'); break; } } @curl_close($ch); } return $result ? $result : false;}
调用这个 paypal nvp 接口时不时就报这个错误 OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to api-3t.paypal.com:443 ,是什么原因导致的啊,导致网站支付经常跳转失败
本文章由 轻惋频道 抓取自RSS,版权归源站点所有。