Php Paypal IPN自定义变量为空
因此,我尝试发送一个带有Paypal自适应支付的自定义变量,当Paypal使用我在Paypal帐户的销售首选项中指定的文件执行IPN时,自定义变量为空。我的Curl代码工作正常,响应信封返回成功。我在发送前回显了post字段,这是我得到的(敏感数据已被审查): actionType=PAY&clientDetails.applicationId=[app ID]&clientDetails.ipAddress=[my ip]Php Paypal IPN自定义变量为空,php,paypal,paypal-ipn,Php,Paypal,Paypal Ipn,因此,我尝试发送一个带有Paypal自适应支付的自定义变量,当Paypal使用我在Paypal帐户的销售首选项中指定的文件执行IPN时,自定义变量为空。我的Curl代码工作正常,响应信封返回成功。我在发送前回显了post字段,这是我得到的(敏感数据已被审查): actionType=PAY&clientDetails.applicationId=[app ID]&clientDetails.ipAddress=[my ip] ·cyCode=USD&feesPayer=EACHRECEIVER&
·cyCode=USD&feesPayer=EACHRECEIVER&memo=[my 备注]&custom=1Ad2Ad8Ad9&receiverList.receiver(0)。金额=1&receiverList.receiver(0)。电子邮件=[email1]&receiverList.receiver(0)。主要=true&receiverList.receiver(1)。金额=0.2&receiverList.receiver(1)。电子邮件=[email2]&receiverList.receiver(1)。主要=false&receiverList.receiver(2)。金额=0.19&receiverList.receiver(2)。电子邮件=[email3]&receiverList.receiver(2) .primary=false&receiverList.receiver(3)。amount=0.16&receiverList.receiver(3)。email=[email4]&receiverList.receiver(3)。primary=false&requestEnvelope.errorLanguage=en_US&returnUrl=[return url]&取消url=[取消url] 自定义变量非常灵活,完全符合我的要求。另一方面,我注意到currencyCode字段以某种方式更改为“·cyCode”。我不知道为什么,但当我将其更改为数组并使用print_r时,它显示为currencyCode 无论如何,当Paypal向my Confirm.php发送即时通知并运行以下代码时,我遇到的问题出现了:
// read the post from PayPal system and add 'cmd'
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}
// post back to PayPal system to validate
$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";
$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);
if (!$fp) {
// HTTP ERROR
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0) {
$strEmail = $_POST[ "payer_email" ];
if( isset( $_POST[ "custom" ] ) == true )
{
$strQuery = "UPDATE TTest SET TestField = 'posted: " . $_POST[ "custom" ] . "' WHERE id = 1";
}
// Execute
mysql_query( $strQuery );
}
else if (strcmp ($res, "INVALID") == 0) {
}
}
fclose ($fp);
}
$_POST[“custom”]变量似乎为空,因为它每次只将TestField设置为“posted:”