Note that there are some explanatory texts on larger screens.

plurals
  1. POPaypal IPN HTTP/1.1 - doesn't provide any response at all, it is an empty string
    text
    copied!<p><strong>This unexplainable probably affects or will affect thousands of webmasters.</strong> </p> <p>The problem is Paypal doesn't give a response to this request AT ALL. Below is the sample code I use and also my programmer's comments:</p> <p>"PayPal doesn't give any response to this request at all, an empty string comes from it. You may ask the PayPal team, if anything besides 'Host' and 'HTTP/1.1' should be added to handle response properly. Could it be that the 'cmd' command should have another value? My expectation is that PayPal will open HTTP/1.1 protocols only in February 2013, as they state in their email. I'm not sure how the same script and host may handle different protocols. The script is not working now with HTTP/1.1 with the code we have on file, and the reason may be on PayPal's side. I was following how PayPal queries the IPN script, and it seems that it goes into some kind of loop, when there's HTTP 1.1 set. You can still see it yourself in ipnlogz.txt - '07%3A39%3A41' - i.e. '07:39:41' date of my order - it's repeated 5 times! Why? Who knows... it only means PayPal was trying to IPN this script 5 times and with no success. There appeared 'VERIFIED' response from PayPal only when I've updated HTTP to 1.0 and re-uploaded the script. After that, PayPal was still querying it. It seems when HTTP = 1.1 , PayPal is getting everything properly, but not responding properly; then for some reason gets back to create yet another response for the same payment. With HTTP 1.0 it's all like a flower: one request, one response, everything works. I don't know what's wrong with it...</p> <p>Ps. We are not talking about an 'INVALID' response. An 'INVALID' response is actually part of success -but in the case of HTTP 1.1, PayPal doesn't provide any response at all, it is an empty string."</p> <pre><code>&lt;?php $req = 'cmd=_notify-validate'; $r=''; foreach ($_POST as $key =&gt; $value) { $value = urlencode(stripslashes($value)); $req .= "&amp;$key=$value"; $r.="{$key}: {$value}\n"; } // 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"; $fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30); #I also tried: $fp =fsockopen('ssl://www.paypal.com',443,$err_num,$err_str,30); if (!$fp) { $r.="----\nHTTP ERROR\n"; // HTTP ERROR } else { $r.="----\nReceived IPN request\n"; fputs ($fp, $header . $req); while (!feof($fp)) { $res = fgets ($fp, 1024); } fclose ($fp); if (strcmp ($res, 'VERIFIED') == 0) { $proceed=TRUE; } else{ $proceed=FALSE; } } ?&gt; </code></pre> <p>PS. This is the <code>notify_url</code> part of the script we use:</p> <pre><code>&lt;input type="hidden" name="notify_url" value="{$main_url}/index.php?action=ipn&amp;amp;user_id={$user_id}" /&gt; </code></pre> <p>and when it was tested in Sandbox it is working..</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload