한글사랑한글사랑
## http://stackoverflow.com/questions/10793017/how-to-easily-decode-htt
p-chunked-encoded-string-when-making-raw-http-request
##
function decode_chunked($str)
{
for ($res = ''; !empty($str); $str = trim($str))
{
$pos = strpos($str, "\r\n");
$len = hexdec(substr($str, 0, $pos));
$res.= substr($str, $pos + 2, $len);
$str = substr($str, $pos + 2 + $len);
}
return $res;
}
|