与Stripe通信时出现意外错误,错误号55

时间:2020-06-21 17:23:16

标签: php stripe-payments

使用条纹付款,我有一个表格,当我提交信息并下订单时,发生了以下错误:

Unexpected error communicating with Stripe. If this problem persists, let us know at support@stripe.com. (Network error [errno 55]: Failed sending HTTP POST request)

我的PHP代码是这样的:

  <?php
    require_once('../vendor/autoload.php');
    
    \Stripe\Stripe::setApiKey(' 
    sk_test_51Gw3j3DiiBRVUNG3QmcK0fjrBkpc31k5bqkX5tP3L5zo4GkLysZEO7iyflCHGoIAa6XtRJMiWjB0inTbZF390JiS00gtV1CREh
    ');

    $POST = filter_var_array($_POST, FILTER_SANITIZE_STRING);
    $first_name = $_POST['first_name'];
    $last_name = $_POST['last_name']; 
    $email = $_POST['email']; 
    $token = $_POST['stripeToken'];  
    
    echo $token . '<br>';
    echo $first_name . '<br>';
    echo $last_name . '<br>'; 
    echo $email . '<br>';  

    \Stripe\Stripe::setVerifySslCerts(false);

    try {
        $customer = \Stripe\Customer::create(array(
            "email" => $email, 
            "source" => $token
        ));
    
        $charge = \Stripe\Charge::create(array(
            "amount" => 5000, 
            "currency" => "usd", 
            "description" => "porn video", 
            "customer" => $customer->id
        ));
    
        print_r($charge);   
    } catch (Exception $s){
        echo $s->getMessage();
    }
?>

输出如下:

Output of the code above

我已经安装了SSL证书。

Mozilla Certificate

我将Wampserver与PHP 7.3.12和Apache 2.4.41结合使用

1 个答案:

答案 0 :(得分:0)

在本地主机上安装SSL毫无意义。改用ngrok