diff options
Diffstat (limited to 'it_url.class')
-rw-r--r-- | it_url.class | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/it_url.class b/it_url.class index aa4f985..91dae20 100644 --- a/it_url.class +++ b/it_url.class @@ -351,12 +351,19 @@ function get($p=null, $timeout=5) * @param $p['urls']: array of urls to get * @param $p['timeout']: timeout per read in seconds, defaults to 5. (TODO: fractions allowed?) * @param $p['totaltimeout']: timeout for the whole function call + * @param $p['headers']: optional array of HTTP headers to send * @return array of contents of resulting page using same keys as the urls input array, * considering redirects, excluding headers */ function get_multi($p=null) { $p += array('totaltimeout' => "999999", 'timeout' => 5, 'retries' => 1); + $p['headers'] = (array)$p['headers'] + array( + 'User-Agent' => "Mozilla/4.0 (compatible; MSIE 7.0; ITools)", + 'Accept-Language' => T_lang(), + ); + foreach ($p['headers'] as $header => $value) + $headers[] = "$header: $value"; $opts = array( CURLOPT_HEADER => false, CURLOPT_RETURNTRANSFER => true, @@ -364,6 +371,7 @@ function get_multi($p=null) CURLOPT_LOW_SPEED_LIMIT => 5, CURLOPT_LOW_SPEED_TIME => $p['timeout'], CURLOPT_FOLLOWLOCATION => true, + CURLOPT_HTTPHEADER => $headers, ); $mh = curl_multi_init(); |