diff options
Diffstat (limited to 'url.class')
-rw-r--r-- | url.class | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -287,8 +287,23 @@ function get($p=null, $timeout=5000) if ($url->result) { - while (!feof($fp)) - $url->data .= @fread($fp, 20480); + if ($url->headers['Transfer-Encoding'] == "chunked") # Bogus HTTP/1.1 chunked answer from server (e.g. Wordpress/Apach2/PHP5) + { + while ($len = hexdec(fgets($fp))) + { + $chunk = ""; + + while (!feof($fp) && (strlen($chunk) < $len)) + $chunk .= @fread($fp, $len - strlen($chunk)); + + $url->data .= $chunk; + } + } + else + { + while (!feof($fp)) + $url->data .= @fread($fp, 20480); + } if ($url->result < 400) $result =& $url->data; |