Paypal IPN HTTP / 1.1 - gives no answer at all, this is an empty line

This inexplicable is likely to affect or affect thousands of webmasters.

The problem is that Paypal does not respond to this AT ALL request. Below is an example of the code that I use, as well as comments by my programmer:

"PayPal does not give an answer to this request at all, it follows an empty line. You can ask the PayPal command if anything other than" Host "and" HTTP / 1.1 "should be added to correctly process the response. Could it be that should the cmd command have a different meaning? I expect PayPal to open HTTP / 1.1 protocols only in February 2013, as their email says. I'm not sure how the same script and host can handle different protocols. the script is no longer It works with HTTP / 1.1 with the code that we have on the file, and the reason may be on the PayPal side. m, as PayPal requests an IPN script, and it seems like it goes into some kind of loop when HTTP 1.1 is installed. You can still see this in ipnlogz.txt - '07% 3A39% 3A41 '- ie '07: 39: 41 'the date of my order - it was repeated 5 times! What for? Who knows ... this means that PayPal tries IPN in this script 5 times and without success. The “VERIFIED” response from PayPal appeared only after updating HTTP to 1.0 and reloading the script. After that, PayPal was still requesting it. It seems that when HTTP = 1.1, PayPal receives everything correctly, but does not respond properly; then for some reason returns to create another answer to the same payment. With HTTP 1.0, it all looks like a flower: one request, one response, everything works. I don’t know what is wrong with him ...PayPal receives everything correctly, but does not respond properly; then for some reason returns to create another answer to the same payment. With HTTP 1.0, it all looks like a flower: one request, one response, everything works. I don’t know what is wrong with him ...PayPal receives everything correctly, but does not respond properly; then for some reason returns to create another answer to the same payment. With HTTP 1.0, it all looks like a flower: one request, one response, everything works. I don’t know what is wrong with him ...

Ps. "INVALID". "INVALID" , HTTP 1.1 PayPal , . "

<?php

$req = 'cmd=_notify-validate';
$r='';

foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$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;
}
}

?>

PS. notify_url script, :

<input type="hidden" name="notify_url" value="{$main_url}/index.php?action=ipn&amp;user_id={$user_id}" />

Sandbox, .

+5
7

:

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

:

// 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";
$header .= "Connection: close\r\n\r\n";
$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);

:

if (strcmp ($res, 'VERIFIED') == 0) {

:

if (strcmp (trim($res), 'VERIFIED') == 0) {

.

, PayPal Connection: keep-alive , fsockopen , , , .
HTTP, cURL, .

; , PayPal, HTTP, ​​ cURL, fsockopen, TCP-.
(PayPal , cURL, https://www.paypal.com/ipn https://www.paypal.com/pdt)

+12

:

if (strcmp ($res, "VERIFIED") == 0) { 

if (strcmp (trim($res), "VERIFIED") == 0) { 

,

+2

2012 IPN PayPal. - , , PayPal IPN .

, paypal ( 2 - - -).

, ( IPN) . , , .

0

, - IPN

IPN PayPal

my accont = > = > = >

0
source

I also have this problem, and PP refuses to admit that there is a problem. I don’t know what to do, but customers will be insane in four months.

One change you have to make is:

$header .= "POST /cgi-bin/webscr HTTP/1.1\r\n"; // wrong  
$header .= "POST cgi-bin/webscr HTTP/1.1\r\n"; // right (according to PP)
-1
source

All Articles