PHP的贝宝不返回任何东西
问题描述:
我正在用贝宝(Paypal)测试我的网站,以查看我是否收到钱并且系统正在更新
I'm test my site with paypal to see if i am receiving money and my system is being updated
当我要求发送包含POST中所有信息的电子邮件时,我得到的电子邮件为空.有人可以告诉我我的代码出了什么问题吗
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);
}
答
在while代码中放入var_dump($ res),因为这是变量所在的上下文.
Put var_dump($res) in the while code since that is context in which the variable exists.