From ae01978eb3c6424cbb7841573c4f574113317a88 Mon Sep 17 00:00:00 2001 From: Ahmad Nassri Date: Thu, 5 Feb 2015 12:48:56 -0500 Subject: [PATCH] php 5.4 cURL does not support setting username and password separately --- src/Unirest/Request.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Unirest/Request.php b/src/Unirest/Request.php index 47e90aa..f215562 100644 --- a/src/Unirest/Request.php +++ b/src/Unirest/Request.php @@ -350,8 +350,7 @@ class Request } if (!empty(self::$auth['user'])) { - curl_setopt($ch, CURLOPT_USERNAME, self::$auth['user']); - curl_setopt($ch, CURLOPT_PASSWORD, self::$auth['pass']); + curl_setopt($ch, CURLOPT_USERPWD, self::$auth['user'] . ':' . self::$auth['pass']); curl_setopt($ch, CURLOPT_HTTPAUTH, self::$auth['method']); } @@ -362,8 +361,7 @@ class Request curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, self::$proxy['tunnel']); curl_setopt($ch, CURLOPT_PROXYAUTH, self::$proxy['auth']['method']); - curl_setopt($ch, CURLOPT_PROXYUSERNAME, self::$proxy['auth']['user']); - curl_setopt($ch, CURLOPT_PROXYPASSWORD, self::$proxy['auth']['pass']); + curl_setopt($ch, CURLOPT_PROXYUSERPWD, self::$proxy['auth']['user'] . ':' . self::$proxy['auth']['pass']); } $response = curl_exec($ch);