Jump to content


Photo

$^&#!@ INVALID!!!


  • This topic is locked This topic is locked
No replies to this topic

#1 Scientifik

Scientifik

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 20 January 2003 - 05:34 AM

Ok a bit of a problem here, I copied and pasted the code from the paypal site, however I get an INVALID response no matter what I've tried. Here's the code, the post variables are coming in fine, and the connection is being made. Everything is great, for some reason IPN always returns INVALID

// read the post from PayPal system and add 'cmd'
$req = "cmd=_notify-validate";

foreach ($HTTP_POST_VARS as $key => $value)
{
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
echo("$key -> $value<br>");
}

// 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('www.paypal.com', 80, $errno, $errstr, 30);

if (!$fp)
{
// ERROR
echo ("$errstr ($errno)");
}
else
{
while (!feof($fp))
{
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0)
{
//code for validating actual transaction
}
else if (strcmp ($res, "INVALID") == 0)
{
// log for manual investigation

}
}

It's very straight forward, but paypal is just not returning the right thing. What am I doing wrong?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users