Curl\Curl::setBasicAuthentication PHP Method

setBasicAuthentication() public method

Set Basic Authentication
public setBasicAuthentication ( $username, $password = '' )
$username
$password
    public function setBasicAuthentication($username, $password = '')
    {
        $this->setOpt(CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
        $this->setOpt(CURLOPT_USERPWD, $username . ':' . $password);
    }

Usage Example

 private function connect()
 {
     $curl = new Curl();
     $curl->setBasicAuthentication($this->adminUsername, $this->adminPassword);
     $curl->setUserAgent('');
     $curl->setReferrer('');
     $curl->setHeader('X-Requested-With', 'XMLHttpRequest');
     $this->curl = $curl;
 }
All Usage Examples Of Curl\Curl::setBasicAuthentication