php - Paypal 快速支付错误 SetExpressCheckout 失败 : Could not resolve host: api-3t(6)

标签 php curl paypal express-checkout

我正在尝试使用我找到的教程测试 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/

相关文章:

paypal - 无法使用 django-paypal 获得有效的 IPN 回发

php - 如何使用 PHP 找到图像的宽度?

php - 捕获数组中 undefined index 并创建它

像 curl 这样的 Python 代码

c++ - 在 Visual Studio 中使用 Libcurl 发出 HTTPS 请求时遇到问题

PayPal 快速结帐 - 销售与付款

php - 图像(Blob)在浏览器中仅显示一次

php - 绘制锦标赛括号(基于 PHP 数据集的 CSS/HTML)

linux - 主机名中的 ssl 错误

用于获取客户数据的 PayPal API 端点