使用$ _REQUEST接受参数

时间:2013-11-19 09:17:00

标签: php payment

我有一个用于接受某些参数的php(status,referenceNo,customerReferenceNo,merchentId,amount,checkSum)。

https://cellpay.essecom.com/PGCCDCToken/TokenPayment.jsp?merchantId=xxxxxx&data=GyT5Sdoc5yUq1448sdsrva0KdhzI%2BprFmbZt8tAcpSfEWNUED%2BsHPf0yGl7bCn%2B%2FWE37yTWve6r4IBpaQWvFWF1ereC5mi6QPcLaYtX9PyvR%2F4LDhcKAK9EauYNGFkBy3lHy4ZLdZELjf5YERUS6i7AlRvGZCzLj0BZmnIBKIrIv%2FeHQxxxxxU6miaurjw%2BuNab%2BQkD0%2FJ4Fy%2FjRb7mr%2F9M7P7BmZwDW2nyNUQmWaKV4Bb3tbB%2BNlKoJRYhCNWOCKSUd1fa543iM3Yz19W6e0BxOq4ufBAMWbxxxxxxxxZEanAK%2BVPkBMiLvFc2mN0xCbw%2FAAvHZGogL5mIvQMHwZVJqtSld9QSJeQOhxxxxxxx8KfI5vHf6epiODYuhBPgTtPX2r9PJRkNimripVwFq0aj%2FJ%2BNyJBdfWH93jKdbSs3NYCSSziVsoHQqGj0mgXcRXOQjZoPaSctcb5VhFEze5azl%2B9BKQ%3D

上面的url是我发送的一些数据,在验证之后,他们将一些参数发送回响应网址,下面的代码是我的reponse.php文件的内容,这是我的响应网址。我使用RESTconsole通过发送相同的参数检查了我的响应URL,它被注入我的db.But我没有得到提供者的响应。我的代码有什么问题吗?

 <?php
        session_start();
        require("./connect.php");

             $status    = $_REQUEST['status'];
             $ref_no= $_REQUEST['referenceNo'];
             $cust_ref_no= $_REQUEST['customerReferenceNo'];
             $merchantId= $_REQUEST['merchantId'];
             $amount= $_REQUEST['amount'];
             $checkSum= $_REQUEST['checkSum'];
              echo "Status is ".$status;
              echo "<br> Ref no is ".$ref_no;
              echo "<br> Cust Ref No is ".$cust_ref_no;
              echo "<br> Merchant ID is ".$merchantId;
              echo "<br> Amount is ".$amount;
              echo "<br> Checksum is ".$checkSum;
              $sql = "INSERT INTO paymentResponse VALUES('','$status','$ref_no','$cust_ref_no','$merchantId','$amount','$checkSum',now())";
              $result=mysql_query($sql);
              echo "<br>Data insert status: ".mysql_error()."<br>";
            if ($status=='0')
            {
             echo "<br>Your transaction is successful and your transaction reference no for any further communication is ".$ref_no;
            }
            else
            {
                 echo "<br>Your transaction failed and your transaction reference no for any further communication is ".$ref_no;
            }
    ?>

Status is 
Ref no is 
Cust Ref No is 
Merchant ID is 
Amount is 
Checksum is 
Data insert status: Duplicate entry '' for key 'referenceNo'

Your transaction failed and your transaction reference no for any further communication is

这是我在页面中得到的唯一响应,db valuess为null

1 个答案:

答案 0 :(得分:1)

  

数据插入状态:密钥'referenceNo'

的重复条目''

表示您在数据库中已存在的数据库中插入具有相同 referenceNo 的数据。

您对此列有约束,不要插入重复的条目。所以你需要尝试新的referenceNo。并且数据没有插入数据。

您可以通过以下方式调试返回数据的数据:

print_r($_REQUEST);

你会得到回报的数据。