检索JSON值

时间:2013-08-27 01:29:14

标签: php json

我正在使用php pay api https://simplepay4u.com/developer.php 我已成功完成每一步,但似乎无法获得返回值以在付款后生成收据。我不知道unotify页面应该做什么。

这是我正确发布的表单:

$action         = $_POST["action"];
$pid            = $_POST["pid"];
$buyer          = $_POST["buyer"];
$total          = $_POST["total"];
$comments       = $_POST["comments"];
$referer        = $_POST["referer"];
$customid       = $_POST["customid"];
$transaction_id = $_POST["customid"];
$val            = @json_encode($_POST);
// For Loging $val can be used
if ($referer == "https://simplepay4u.com"
    || $referer == "https://www.simplepay4u.com"
    || "http://sandbox.simplepay4u.com/process.php") //1st level checking
{
    if (!empty($transaction_id)) //2nd level checking
    {
        /*** Server side verification. Your server is communicating with Simplepay Server Internally**/
        //$simplepay_url="https://simplepay4u.com/processverify.php"; // Live URL
        $simplepay_url   = "http://sandbox.simplepay4u.com/processverify.php";
        $curldata["cmd"] = "_notify-validate";
        foreach ($_REQUEST as $key => $value) {
            if ($key != 'view' && $key != 'layout') {
                $value          = urlencode($value);
                $curldata[$key] = $value;
            }
        }
        $handle = curl_init();
        curl_setopt($handle, CURLOPT_URL, $simplepay_url);
        curl_setopt($handle, CURLOPT_POST, 1);
        curl_setopt($handle, CURLOPT_POSTFIELDS, $curldata);
        curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($handle, CURLOPT_TIMEOUT, 90);
        $result = curl_exec($handle);
        curl_close($handle);
        var_dump(json_decode($result));

        enter code here
        if ('VERIFIED' == $result) {
            //  IMPLEMENTATION CODE & aPPLICATION lOGIC WILL GO HER TO UPDATE THE ACCOUNT
        }
    }
}

我已设置我的ureturn页面以执行上述脚本并尝试var_dump(json_decode($result))print_r($result)echo $result;只是为了看到一些内容,但我得到了结果。

有人可以告诉我在发布我已经工作的表格后如何获取我的回报值吗?

0 个答案:

没有答案