note 92500 deleted from function.fsockopen by danbrown
| From: | danbrown@php.net | Date: | Mon, 27 Jul 2009 16:54:46 +0000 |
| Subject: | note 92500 deleted from function.fsockopen by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-158784@lists.php.net to get a copy of this message | ||
Note Submitter: nmmm at nmmm dot nu
----
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