我正在尝试使用我找到的教程测试 Paypal 快速结账。
我在本地电脑上使用 php。
我正在使用 Firefox 进行测试。
当调用 paypal 时,我得到了这个错误: SetExpressCheckout 失败:无法解析主机:api-3t(6)
我尝试了这里帖子中的解决方案,上面写着:将名称服务器切换到 8.8.8.8 和 8.8.4.4 的 Google 公共(public) DNS
没用
我的代码:
$API_Endpoint = "https://api-3t/".$GLOBALS['paypal_mode'].".paypal.com/nvp";
$version = urlencode('124.0');
// Set the curl parameters.
$ch = curl_init();
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);
// Set the API operation, version, and API signature in the request.
$nvpreq = "METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature$nvpStr_";
// Set the request as a POST FIELD for curl.
curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);
// Get response from the server.
$httpResponse = curl_exec($ch);
有人可以帮忙吗?
谢谢
最佳答案
您当前的主机是 api-3t/sandbox.paypal.com/nvp
这是正确的。正确的主机是 https://api-3t.sandbox.paypal.com/nvp
改变自
$API_Endpoint = "https://api-3t/".$GLOBALS['paypal_mode'].".paypal.com/nvp";
到
$API_Endpoint = "https://api-3t.".$GLOBALS['paypal_mode'].".paypal.com/nvp";
关于php - Paypal 快速支付错误 SetExpressCheckout 失败 : Could not resolve host: api-3t(6),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31853499/