php paypal is not return anything

2019-09-20 12:25发布

I'm test my site with paypal to see if i am receiving money and my system is being updated

When I ask to send email with all the information in POST I get empty email. Can someone tell me what is wrong with my code

$req = 'cmd=_notify-validate';
$req .= payment_safe_check ($_POST);

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

$mode = strtolower($paymod_data['PAYMENT_MODE']);

    mail("to email", "subject",serialize($_POST) );


if ($mode == 'test')
{
    $fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);
}
else
{
    $fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);
}

if (!$fp)
{
    // HTTP ERROR
    die ("Error");
}
else 
{
    // NO HTTP ERROR
    fputs ( $fp, $header . $req );
    while (!feof($fp))
    {
        $res = fgets ($fp, 1024);
        if (strcmp ($res, "VERIFIED") == 0)
        {
            processing ( $_POST );
        }
        else if (strcmp ($res, "INVALID") == 0)
        {

        }
    }
    fclose ($fp);
}

标签: php paypal
1条回答
Deceive 欺骗
2楼-- · 2019-09-20 12:52

Put var_dump($res) in the while code since that is context in which the variable exists.

查看更多
登录 后发表回答