note 92500 added to function.fsockopen
| From: | nmmm at nmmm dot nu | Date: | Mon, 27 Jul 2009 16:36:29 +0000 |
| Subject: | note 92500 added to function.fsockopen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-158783@lists.php.net to get a copy of this message | ||
This is a note to post by dmitry dot polushkin at gmail dot com
He probably worked on Windows.
The correct code is:
$terminator = "\n" . "\r\n0\r\n\r\n";
if (substr($data, -1 * strlen($terminator) ) == $terminator)
exit; // break
note the first \n, it is the end of the file, which on UNIX/Linux is \n, and not \r\n.
I guess even safe source will be to ignore it at all:
terminator = "\r\n0\r\n\r\n";
if (substr($data, -1 * strlen($terminator) ) == $terminator)
exit; // break
----
Server IP: 217.75.128.29
Probable Submitter: 85.130.92.216
----
Manual Page -- http://www.php.net/manual/en/function.fsockopen.php
Edit -- https://master.php.net/note/edit/92500
Del: integrated -- https://master.php.net/note/delete/92500/integrated
Del: useless -- https://master.php.net/note/delete/92500/useless
Del: bad code -- https://master.php.net/note/delete/92500/bad+code
Del: spam -- https://master.php.net/note/delete/92500/spam
Del: non-english -- https://master.php.net/note/delete/92500/non-english
Del: in docs -- https://master.php.net/note/delete/92500/in+docs
Del: other reasons-- https://master.php.net/note/delete/92500
Reject -- https://master.php.net/note/reject/92500
Search -- https://master.php.net/manage/user-notes.php