我在PHP中使用paypal的示例代码 https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/library_code
但每当我运行此示例代码时,我都会收到此错误。
“DoDirectPayment失败:无法连接到主机(7)”
我不知道问题是什么。
注意:我正在使用本地WAMP服务器来运行此示例。
答案 0 :(得分:1)
// 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