php - fsockopen() returns null pointer, and $errstr is empty (no error message) -


[edit]

I've redirected the previous question - because I thought this was incorrect What was the problem - and so I had enough snippets that had a red herring. Thanks for the Wimdvx, I have a clear idea about what has happened.

First of all, I am using code to handle IPN notifications from PayPal.

I was unable to connect using fsockopen, so I wrote a small snippet (shown below) to try to connect to PayPal.

  & lt ;? Php $ fp = fsockopen ("www.sandbox Paypal.com/cgi-bin/webscr", $ 80, $ errno, $ errstr, 30); If (! $ FP) {echo "$ errstr ($ errno) 
" } And {$ out = "GET / HTTP / 1.1 \ r \ n"; $ Out = "Host: www.sandbox.paypal.com/cgi-bin/webscr\r\n"; $ Out = "Connection: Close \ r \ n \ n \ n"; FILIT ($ FP, $ out); }

?>

?

When I run this small script, I get the following error on my server:

PHP Warning: Fsockopen (): php_network_getaddrips: getaddrinfo failed: name / Service / line / 2 is not known in the line / test-socket.php PHP 2 Warning: fsockopen (): Unable to connect to www.sandbox.paypal.com/cgi-bin/Webcr: 80 (php_network_getaddresses) : Getaddrinfo failed: name or service is not known in line 2 php_network_getaddresses at /home/minime/test-socket.php): getaddrinfo failed: name or service

< P> i server But Ubuntu running 10.0.4 LTS

You do not open a socket in the URL, you have to open it in the IP or FQDN.

Using

  $ socket_ur = 'www.mywebsite.com';  

Can help.

But what are you really trying to achieve?


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -