这是我的贝宝 api 代码。我已经验证了两个帐户,付款也已付款...但我仍然收到一封失败的电子邮件..我无法理解的原因是什么...
<?php
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value)
{
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}
$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 = $paymod_data['MODULE_PAYMENT_PAYPAL_TESTMODE'];
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
{
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp (trim($res), "VERIFIED") == 0) {
// check the payment_status is Completed
// check that txn_id has not been previously processed
// check that receiver_email is your Primary PayPal email
// check that payment_amount/payment_currency are correct
// process payment
echo strcmp ($res, "VERIFIED");
echo strcmp (trim($res), "INVALID");
mail("aks0130@gmail.com","sucess","aa gyi mail","From: demo2312@gmail.com");
}
else if (strcmp ($res, "INVALID") == 0) {
// log for manual investigation
echo strcmp (trim($res), "INVALID");
echo strcmp (trim($res), "VERIFIED");
mail("aks0130@gmail.com","fail","nahi aa gyi mail","From: demo2312@gmail.com");
}
}
fclose ($fp);
}
?>
自 3-4 天以来,我一直在尝试正确完成它,但在静脉中.. 所以我回到了 stackoverflow