【发布时间】:2011-07-20 05:38:26
【问题描述】:
我在 php 中使用 paypal 的示例代码 https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/library_code
但每当我运行此示例代码时,我都会收到此错误。
“DoDirectPayment 失败:无法连接到主机 (7)”
我不知道是什么问题。
注意:我正在使用本地 WAMP 服务器来运行此示例。
【问题讨论】:
我在 php 中使用 paypal 的示例代码 https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/library_code
但每当我运行此示例代码时,我都会收到此错误。
“DoDirectPayment 失败:无法连接到主机 (7)”
我不知道是什么问题。
注意:我正在使用本地 WAMP 服务器来运行此示例。
【问题讨论】:
// Set the curl parameters.
- $ch = curl_init();
curl_setopt($ch, CURLOPT_PROXY, " http://username:password@proxyserver.net:port/";);
curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
curl_setopt($ch, CURLOPT_VERBOSE, 1); // Turn off the server and peer //verification(TrustManager Concept).
curl_setopt($ch,
CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch,
CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch,
CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
//The rest of the code from paypal site
【讨论】: