这是我的代码:
// post back to PayPal system to validate
$header .= "POST cgi-bin/webscr HTTP/1.1\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .="Host: www.paypal.com\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$header .="Connection: close\r\n\r\n";
$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);
if (!$fp) { // HTTP ERROR
echo 'HTTP ERROR';
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) { $res = fgets ($fp, 2048); }
if (strpos ($res), "VERIFIED") !== false) {
switch ($transaction_type) {
case "subscr_payment":
if ($payment_status == "Completed" &&strtolower($receiver_email) == strtolower($receiverEmail)&&$currency=$payment_currency)
早些时候我曾尝试将trim
语句输入这一行:
if (strpos ($res, "VERIFIED") !== false)
我将其更改为:
if (strcmp (trim($res), 'VERIFIED') == 0)