FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Paypal IPN and HTTP 1.1
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Paypal IPN and HTTP 1.1 [message #182232 is a reply to message #182228] Mon, 22 July 2013 20:33 Go to previous message
Mitch Bujard is currently offline  Mitch Bujard
Messages: 19
Registered: July 2013
Karma:
Junior Member
On 2013-07-22 14:33:32 +0000, j said:

> On 7/20/2013 6:25 AM, Mitch Bujard wrote:
>> On 2013-07-17 13:36:58 +0000, Mitch Bujard said:
>>
>>> Today I got a message from Paypal entitled 'Action required before
>>> October 7, 2013'. It says that at that date, IPN listener scripts will
>>> have to be conformant to HTTP: 1.1 or they will stop working.
>
> This looks like a server issue. HTTP 1.1 has been around for quite a
> while, why are you at 1.0?
>
> I'm not sure what you can do in PHP other than send some headers with
> the host info. Otherwise I see that there are a number of changes in
> 1.1 that can't be spoofed with a header.

I finally got it to work. The code at paypal support page was helpful.
I followed scrupulously what they advise, and it works !

Thank you for your support.

Now, I can concentrate on creating nice Xojo web apps, but it's not php ;^}

Mitch
http://FontMenu.com
---

Here is the code :
PN: HTTP1.0 to HTTP1.1 - php coding tips
Published 01/25/2013 10:23 AM   |    Updated 02/07/2013 02:05 AM
Developers need to include the "Host" and "Connection" headers in the
IPN postback script:

PHP
// post back to PayPal system to validate
$header .= "POST /cgi-bin/webscr HTTP/1.1\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Host: www.paypal.com\r\n";
$header .= "Connection: close\r\n\r\n";


PLEASE NOTE:

1)     For further compatibility your php script should also trim the
IPN validation response.
Please modify your script:

From:
if (strcmp ($res, "VERIFIED") == 0) {
...
else if (strcmp ($res, "INVALID") == 0) {

To:
if (strcmp (trim($res), "VERIFIED") == 0) {
...
else if (strcmp (trim($res), "INVALID") == 0) {


2)     In php make sure the last line of your header includes double
end-of-line markers: \r\n\r\n as in the example above: $header
..="Connection: close\r\n\r\n";

3)     In php make sure to open the socket connection to the same host
declared in the header. As your header is declaring the host as

$header .="Host: www.paypal.com\r\n";

        You should open the connection to the same host:

$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Easy to use ORM with fulltext search and/or search library
Next Topic: A curious thing...about tags.
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Sep 19 01:15:11 GMT 2024

Total time taken to generate the page: 0.07209 seconds