Question

I've tried EVERYTHING, but keep getting "reset by peer" when attempting to verify/validate..
Here's my distilled code:

<?php
header('HTTP/1.1 200 OK');

$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) // $_POST looks OK to me..
    $req .= "&$key=".urlencode(stripslashes($value));

$fp = fsockopen("ssl://www.sandbox.paypal.com", 443, $errno, $errstr, 60); // true

$header  = "POST /cgi-bin/webscr HTTP/1.1\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Conection: Close\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";

fputs ($fp, $header . $req);
while (!feof($fp))
    {
    $res = fgets ($fp, 1024); // CONNECTION RESET BY PEER : (
    if ($res === "VERIFIED")    $response = "VERIFIED";
    if ($res === "INVALID") $response = "INVALID";
    }
fclose($fp);

Why won't they talk to me ?!?

Was it helpful?

Solution

OK. Found some example code that got me through it all:
https://github.com/paypal/ipn-code-samples/blob/master/paypal_ipn.php
- after receiving "VERIFIED", I could use my code from 3 years ago : )

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top