0

I do get few failures for the IPN notification with fscockopen function. but this happens only once in a while, i doubt its problem in the php configuration.

see the following code, is there a work around for this rather than using the PHP fsockopen() function ? may be CURL ? is this possible to do this in CURL ?

    $fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30 );
    if (!$fp) { 
        $this->error_out("PHP fsockopen() error: " . $errstr , "");
    } 

Any alternative solution or any robust error checking suggestions ?

mahen3d
  • 7,047
  • 13
  • 51
  • 103
  • CURL sounds good to me. You can see this thread http://stackoverflow.com/questions/1776827/php-curl-paypal-sandbox – Dr. Dan Jul 27 '12 at 11:31
  • 1
    What's wrong with `fopen('https://www.paypal.com/', 'r');`? Doing it at the socket level is pretty advanced and somewhat pointless given the plethora of HTTP request options PHP provides... Even creating a stream rather than just using `file_get_contents()` is rarely required. – DaveRandom Jul 27 '12 at 11:33

1 Answers1

1

I found this is working and very useful..it uses curl and if needed we can use the fsock method also.

Very clean script, which makes it easy to understand the parts of a transaction and edit things.

Yanick Rochon
  • 51,409
  • 25
  • 133
  • 214
mahen3d
  • 7,047
  • 13
  • 51
  • 103