protected function setAuth(&$curlHandle) {
        if ($this->username !== null && $this->password !== null) {
            \curl_setopt($curlHandle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
            \curl_setopt($curlHandle, CURLOPT_USERPWD, base64_encode($this->username . ':' . $this->password));
//                        \curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
//                        \curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
        }
    }
protected function setAuth(&$curlHandle) {
        if ($this->username !== null && $this->password !== null) {
            \curl_setopt($curlHandle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
            \curl_setopt($curlHandle, CURLOPT_USERPWD, base64_encode($this->username . ':' . $this->password));
//                        \curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
//                        \curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
        }
    }
protected function setAuth ( & $ curlHandle ) { if ( $ this -> username !== null && $ this -> password !== null ) { \ curl_setopt ( $ curlHandle , CURLOPT_HTTPAUTH , CURLAUTH_BASIC ) ; \ curl_setopt ( $ curlHandle , CURLOPT_USERPWD , base64_encode ( $ this -> username . ':' . $ this -> password ) ) ; //                        \curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); //                        \curl_setopt($ch, CURLOPT_USERPWD, "$username:$password"); } }
Set Basic Authentication Headers to Curl Options
@param object $curlHandle
Set Basic Authentication Headers to Curl Options