note 60402 deleted from function.fsockopen by mazzanet
| From: | mazzanet@php.net | Date: | Fri, 06 Jan 2006 09:42:41 +0000 |
| Subject: | note 60402 deleted from function.fsockopen by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-101290@lists.php.net to get a copy of this message | ||
Note Submitter:
----
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;
}