Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 贝宝卷曲误差_Php_Curl_Paypal - Fatal编程技术网

Php 贝宝卷曲误差

Php 贝宝卷曲误差,php,curl,paypal,Php,Curl,Paypal,我有以下代码,在成功付款时给我错误信息 <?php $name = "pra_api1.mymail.sutd.edu.sg"; $password = "EJLV5PRE9Q3"; $signature = "AFcWxVRCpSSRl31NmODmpouHa5SPBWS1"; $endpoint = 'https://api-3t.sandbox.paypal.com/nvp'; session_start(); $amtDonate

我有以下代码,在成功付款时给我错误信息

<?php
    $name = "pra_api1.mymail.sutd.edu.sg";
    $password = "EJLV5PRE9Q3";
    $signature = "AFcWxVRCpSSRl31NmODmpouHa5SPBWS1";
    $endpoint = 'https://api-3t.sandbox.paypal.com/nvp';
    session_start();

    $amtDonate = $_SESSION['try'];
    $curren = $_SESSION['cure'];
 $params2 = array(
        'METHOD'=> 'DoExpressCheckoutPayment',
            'VERSION'=> '74.0',
            'TOKEN' => $_GET['token'],
            'PAYMENTACTION' => 'Sale',
            'USER'=> $name,
            'SIGNATURE'=> $signature,
            'PWD'=> $password,
            'PAYERID' => $_GET['PayerID'],
            'PAYMENTREQUEST_0_AMT'=> $amtDonate,
            'PAYMENTREQUEST_0_CURRENCYCODE' =>$curren
    );
    $params2 = http_build_query($params2);
    $curl2 = curl_init();
    curl_setopt_array($curl2, array(
        CURLOPT_URL => $endpoint,
        CURLOPT_POST => 1,
        CURLOPT_POSTFIELDS => $params2,
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_SSL_VERIFYPEER => false,
        CURLOPT_SSL_VERIFYHOST => false,
        CURLOPT_VERBOSE => 1));
    $response2 = curl_exec($curl2);
    $responseArray2 = array();
    parse_str($response2,$responseArray2);
    //var_dump($responseArray2);
    curl_close($curl2);

    if (curl_errno($curl2)){
    //  var_dump(curl_error($curl2));
        curl_close($curl2);
        die();
    } else {
        if ($responseArray2['ACK']=="Success"){
        } else {
            var_dump($responseArray2);
            die();

        }
                    curl_close($curl2);

    }

        $params = array(
        'METHOD'=> 'GetExpressCheckoutDetails',
            'VERSION'=> '74.0',
            'TOKEN' => $_GET['token'],
            'USER'=> $name,
            'SIGNATURE'=> $signature,
            'PWD'=> $password);
    $params = http_build_query($params);
    $curl = curl_init();
    curl_setopt_array($curl, array(
        CURLOPT_URL => $endpoint,
        CURLOPT_POST => 1,
        CURLOPT_POSTFIELDS => $params,
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_SSL_VERIFYPEER => false,
        CURLOPT_SSL_VERIFYHOST => false,
        CURLOPT_VERBOSE => 1));
    $response = curl_exec($curl);
    $responseArray = array();
    parse_str($response,$responseArray);
    //var_dump($responseArray);
    curl_close($curl);

    if (curl_errno($curl)){
    //  var_dump(curl_error($curl));
        curl_close($curl);
        die();
    } else {
        if ($responseArray['CHECKOUTSTATUS']=='PaymentActionCompleted'){
            header( "refresh:3;url=index.php" );

        } else {
            var_dump($responseArray);
            die();

        }
                    curl_close($curl);

    }
?>
<html>
<meta charset="UTF-8" />
<title>We Empower Her</title>
<style>
body {margin:0px;}
#whole{ margin:0px;
    padding:0px;
    width: 100vw;
    height: 100vh;
    background-color: #e25154;
    }
#tex{
    padding: 40px;
    font-size: 30px;
}
</style>
<body>
    <div id ="whole">
        <p id="tex"> Your transaction has been completed. Thank you for your generous contribution.</p>
    </div>
</body>
</html>


我们赋予她权力
正文{margin:0px;}
#整{页边距:0px;
填充:0px;
宽度:100vw;
高度:100vh;
背景色:#e25154;
}
#特克斯{
填充:40px;
字体大小:30px;
}

您的交易已完成。谢谢你的慷慨捐助


看起来你的代码有点过头了。我建议清理多余的通话

Warning#1 = You already closed the $curl2 handle on line 36  
Warning#2 = $curl2 Handle already closed  
Warning#3 = $curl handle already closed  
Warning#4 = Looks like you're too late to set a header at this stage. As line#38 caused an error message, you might be fine as soon as you've fixed the warnings or as soon as you disable PHP warning messages in your php.ini file
Warning#5 = Yet another curl_close() for an already closed handle.