My IPN code used to work - but no longer. What changed?

weissmar48
Contributor
Contributor

This IPN handshake code used to work just fine.  Now it doesn't.  My code didn't change.  What did?  I have truncated the complete php module past the handshake, because it doesn't get that far anymore.

 

<?php

$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}

$environment = 'Live';
$header = "POST /cgi-bin/webscr HTTP/1.1\r\nHost: ipnpb.paypal.com:443\r\n";
$fp = fsockopen('ssl://ipnpb.paypal.com', 443, $errno, $errstr, 30);
$header .= "Content-Type: application/x-www-form-urlencoded\r\nContent-Length: ";
$header .= strlen($req) . "\r\n\r\n";

$today = $_POST['payment_date'];
$lastname = $_POST['last_name'];
$amount = $_POST['payment_gross'];
$currency = $_POST['mc_currency'];
$fee = $_POST['mc_fee'];
$firstname = $_POST['first_name'];
$donoremail = $_POST['receiver_email'];
$invoice = $_POST['invoice'];
$custom = $_POST['custom'];

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);

 

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.