note 86621 added to function.fsockopen
| From: | laisebrown at gmail dot com | Date: | Sun, 26 Oct 2008 23:30:28 +0000 |
| Subject: | note 86621 added to function.fsockopen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-145784@lists.php.net to get a copy of this message | ||
When you're connecting through a proxy server you can't rely on fsockopen returning false
to indicate that the connection has failed. (This also applies to fgets and fwrite.)
To check whether the proxy succeeded in contacting the real target host, you need to look for the
http response code in the headers that get returned. Typically, if the proxy was unable to reach the
host, you'll find a line containing something like:
HTTP/1.0 503 Service Unavailable
----
Server IP: 195.221.21.36
Probable Submitter: 129.184.84.11
----
Manual Page -- http://www.php.net/manual/en/function.fsockopen.php
Edit -- https://master.php.net/note/edit/86621
Del: integrated -- https://master.php.net/note/delete/86621/integrated
Del: useless -- https://master.php.net/note/delete/86621/useless
Del: bad code -- https://master.php.net/note/delete/86621/bad+code
Del: spam -- https://master.php.net/note/delete/86621/spam
Del: non-english -- https://master.php.net/note/delete/86621/non-english
Del: in docs -- https://master.php.net/note/delete/86621/in+docs
Del: other reasons-- https://master.php.net/note/delete/86621
Reject -- https://master.php.net/note/reject/86621
Search -- https://master.php.net/manage/user-notes.php