diff options
-rw-r--r-- | it_url.class | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/it_url.class b/it_url.class index 2b1ee18..3525117 100644 --- a/it_url.class +++ b/it_url.class @@ -104,6 +104,7 @@ function is_reachable($timeout = 5) * @param $p['files'] [fieldname => filename] of files to upload * @param $p['retries'] Number of retries if download fails, default 1 * @param $p['retrysleep'] Number of seconds to wait before retry, fractions ok + * @param $p['compression'] use compression (uses curl to do that) * @return contents of resulting page, considering redirects, excluding headers, or false on error */ function get($p=null, $timeout=5) @@ -124,7 +125,7 @@ function get($p=null, $timeout=5) else # called statically $url = new it_url($p['url']); - if ($url->protocol == 'http' && !$p['curl'] && !$p['files']) # only curl can do file upload or non-http protocols + if ($url->protocol == 'http' && !$p['curl'] && !$p['files'] && !$p['compression']) # only curl can do file upload or non-http protocols $result = $url->request($p); else $result = $url->request_curl($p); @@ -298,6 +299,9 @@ static function curl_opts($p=array()) if ($p['data']) $add[CURLOPT_POSTFIELDS] = $p['data']; + if ($p['compression']) + $add[CURLOPT_ENCODING] = ""; + return (array)$add + array( CURLOPT_HEADER => false, CURLOPT_RETURNTRANSFER => true, |