note 60402 added to function.fsockopen
| From: | php-general at lists dot php dot net | Date: | Thu, 05 Jan 2006 22:57:59 +0000 |
| Subject: | note 60402 added to function.fsockopen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-101275@lists.php.net to get a copy of this message | ||
Here is a similar function that can handle responses which contain line breaks in the returned
content:
function ParseChunked($response)
{
$response = explode("\r\n",$response);
$active = 0;
for($i=0; $i<count($response); $i++)
{
if(!$active)
{
if($response[$i]=='')
$active = 1;
continue;
}
if($len)
{
$curentReturn[] = $response[$i];
if(strlen(@implode("\r\n",$curentReturn))==$len)
{
$len = 0;
$return .= implode("\r\n",$curentReturn);
$curentReturn = array();
}
else
continue;
}
$len = hexdec($response[$i]);
}
return $return;
}
----
Manual Page -- http://www.php.net/manual/en/function.fsockopen.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+60402
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60402&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60402&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60402&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60402&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60402&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60402&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60402&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+60402&report=yes
Search -- http://master.php.net/manage/user-notes.php