I recently received an email from PAYPAL saying that our IPN Listener is failing. Nobody has touched that code in about 7 years. I looked at it, and the only thing I can see wrong is, I don't see an HTTP Response Code 200 being sent. Was this requirement added in the past 7 years? This code is PHP. Can anyone help me to modify the code to send the HTTP Response Code 200? Code is below: <?php $req = 'cmd=_notify-validate'; foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } $header = "POST /cgi-bin/webscr HTTP/1.1\r\nHost: ipnpb.paypal.com:443\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\nContent-Length: "; $header .= strlen($req) . "\r\n\r\n"; $fp = fsockopen('ssl://ipnpb.paypal.com', 443, $errno, $errstr, 30); $today = $_POST['payment_date']; $lastname = $_POST['last_name']; $amount = $_POST['payment_gross']; $currency = $_POST['mc_currency']; $fee = $_POST['mc_fee']; $firstname = $_POST['first_name']; $jwvemail = $_POST['receiver_email']; $invoice = $_POST['invoice']; if (!$fp) { $ipn_verified = false; } else { fputs ($fp, $header . $req); while (!feof($fp)) { $res = fgets ($fp, 1024); if (strcmp (trim($res), "VERIFIED") == 0) { $ipn_verified = true; break; } else if (strcmp (trim($res), "INVALID") == 0) { $ipn_verified = false; break; } } } fclose($fp);
... View more