douxin8610 2016-11-15 01:45
浏览 64
已采纳

PayPal notify_url无法通过strcmp验证

I'm having some issues with my notify_url in PayPal. The handshake is fine, but the code to update my DB doesn't work. So to debug, I'm using the return.php url to output some data and try to debug and echo where the problem is.

Here is what I did so far to debug (on return.php)

$req = 'cmd=_notify-validate';
 foreach ($_POST as $key => $value) 
{
    $value = urlencode(stripslashes($value));
    $req .= "&$key=$value";
}

echo "<br>test REQ: ".$req."<br><br>";;

$header .= "POST /cgi-bin/webscr HTTP/1.0
";
$header .= "Content-Type: application/x-www-form-urlencoded
";
$header .= "Content-Length: " . strlen($req) . "

";


$fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);

if (!$fp) 
{
    echo "FP NOT WORKIGN";
} 
else 
{
    echo "FP WORKIGN<br><br>";

    fputs ($fp, $header . $req);

    while (!feof($fp)) 
    {
        echo "whie: YES<br>";
        $res = fgets ($fp, 1024);
        if (strcmp ($res, "VERIFIED") == 0) 
        {
            echo "verified<br>";

            if($status == "Completed")
            {   
                echo "<br>####### completed<br>";
            }
        }
    }
}

My result is I get the echo of REQ, I get the echo of FP Working, I get echo "WHILE YES" 5 times, but I don't the echo of "VERIFIED". SO it seems the script doesn't get pass the if (strcmp ($res, "VERIFIED") == 0)

I'm stuck now, how can I fix this issue? Not sure what's wrong

This is the echo of my $req (if it helps to debug)

test: cmd=_notify-validate&mc_gross=1.00&protection_eligibility=Ineligible&payer_id=3EW5DFETD3E4L&tax=0.00&payment_date=15%3A35%3A43+Nov+14%2C+2016+PST&payment_status=Completed&charset=windows-1252&first_name=test&mc_fee=0.33¬ify_version=3.8&custom=1000%40%40Katia%40%40213+st-louis%40%40lemoyne%40%40quebec%40%40j4r+2l3%40%40Canada%40%401%40%40CAD%40%400%40%401.00&payer_status=verified&business=louisefrigon1-facilitator%40gmail.com&quantity=1&payer_email=louisefrigon1-buyer%40gmail.com&verify_sign=AFcWxV21C7fd0v3bYYYRCpSSRl31AchhgWj8TBE3e7K7SSx6jHwconuT&txn_id=6E11719159210262F&payment_type=instant&last_name=buyer&receiver_email=louisefrigon1-facilitator%40gmail.com&payment_fee=&receiver_id=LMCZ83V6LRE4S&txn_type=web_accept&item_name=Superfood+Powder&mc_currency=CAD&item_number=&residence_country=CA&test_ipn=1&handling_amount=0.00&transaction_subject=&payment_gross=&shipping=0.00&merchant_return_link=click+here&auth=A1CZ8ecFDP.O-dZHCSU6ouq8Gxn8qrDXHyoUX9qI-CEmFlvuS1Rq8FlqPmP8dCqlTffcxTJX84-huLEvRi5C.fA
  • 写回答

1条回答 默认 最新

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥15 FDTD仿真模型建立提问
      • ¥15 yolov5运行detect 过程中的报错一直无法解决
      • ¥15 jsx写法 插槽不生效的问题
      • ¥15 MATLAB 调用comsol如何加速设计?
      • ¥15 echarts地图添加点击事件
      • ¥15 openpyxl库无法全部写入文本到单元格
      • ¥15 不知道带什么标题好随便搞一个吧
      • ¥15 ffmpeg 图片合成视频
      • ¥15 软科大学爬取获取所有数据
      • ¥15 如何修改损失函数以及代码讲解