diff options
Diffstat (limited to 'it_url.class')
-rw-r--r-- | it_url.class | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/it_url.class b/it_url.class index ce98547..608e6b7 100644 --- a/it_url.class +++ b/it_url.class @@ -306,6 +306,11 @@ static function curl_opts($p=array()) if ($p['compression']) $add[CURLOPT_ENCODING] = ""; + if ($p['pass'] || $p['user']) { + curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); + curl_setopt($ch, CURLOPT_USERPWD, $p['user'] . ':' . $p['pass']); + } + return (array)$add + array( CURLOPT_HEADER => false, CURLOPT_RETURNTRANSFER => true, @@ -341,7 +346,7 @@ function request_curl($p=array()) $url->headers = array(); $p['headers'] = (array)$p['headers'] + self::_default_headers($url, $p); - $opts = array(CURLOPT_FOLLOWLOCATION => false, CURLOPT_HEADER => 1) + self::curl_opts($p); + $opts = array(CURLOPT_FOLLOWLOCATION => false, CURLOPT_HEADER => 1) + self::curl_opts($p + array('user' => $this->user, 'pass' => $this->pass)); $curl = curl_init($url->rawurl); curl_setopt_array($curl, $opts); |