几天前,突然停止接收来自PayPal的IPN消息。 我已经写在下面无法获得PayPal IPN沙箱的回复
$url_parsed=parse_url('https://www.sandbox.paypal.com/cgi-bin/webscr');
$post_string = '';
foreach ($_POST as $field=>$value) {
$post_string .= $field.'='.urlencode(stripslashes($value)).'&';
}
$post_string.="cmd=_notify-validate";
$fp = fsockopen($url_parsed['host'],"80",$err_num,$err_str,30);
$myFile = "testpaypal.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = $post_string;
fwrite($fh, $stringData);
fwrite($fh, "------------");
if(!$fp){
return false;
} else {
fputs($fp, "POST $url_parsed[path] HTTP/1.0\r\n");
fputs($fp, "Host: $url_parsed[host]\r\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
fputs($fp, "Content-length: ".strlen($post_string)."\r\n");
fputs($fp, "Connection: close\r\n\r\n");
fputs($fp, $post_string . "\r\n\r\n");
while(!feof($fp))
{
$ipn_response .= fgets($fp, 1024);
}
fclose($fp);
if (eregi("VERIFIED",$ipn_response)) {
fwrite($fh, "VERIFIED");
return true;
} else {
fwrite($fh, "UNVERIFIED");
return false;
}
}
fclose($fh);
该代码的代码返回到err_num “” 以及当我后打印$ ipn_response “FCLOSE($ FP);”行它打印 “HTTP/1.0 302找到的位置:https://www.sandbox.paypal.com服务器:BIGIP连接:关闭内容长度:0”
,但无法在$ ipn_respnse得到 “已检查”。
我已经尝试了所有可能的方法,如更改解析网址与“ssl://sandbox.paypal.com” 和网络上建议的所有其他解决方案。
自从最近三天以来,我一直陷在这个问题中。所以,请帮助我。
在此先感谢。
是的,我已经做了沙箱为了在这里提到它,以及在我的phpinfo卷曲启用。 cURL支持\t已启用 cURL信息\t libcurl/7.16。0 OpenSSL/0.9.8i zlib/1.2.3 – user1996999 2013-02-12 08:44:30