PHP: How to check for response code?

Posted by Tom on Stack Overflow See other posts from Stack Overflow or by Tom
Published on 2010-05-16T13:56:51Z Indexed on 2010/05/16 14:00 UTC
Read the original article Hit count: 174

Filed under:
|
|
|
|

Hi,

I'm a relative PHP newbie implementing a PayPal IPN listener and all seems to be working fine, except I dont really know how to check for a response code.

I've tried something ugly with cURL but it doesn't work at all (I'm not understanding cURL).

I've tried this piece of code that I grabbed from somewhere on the net:

$fp = fsockopen('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);
$response_headers = get_headers($fp);
$response_code = (int)substr($headers[0], 9, 3);

... but it's not working (returns $response_code = 0).

So right now, I'm debugging my IPN code without checking for a Response 200.

Can anyone more experienced advise me on what's the proper/simple way to check this?

Thanks

© Stack Overflow or respective owner

Related posts about php

Related posts about paypal