Curl\Curl::setDigestAuthentication PHP Method

setDigestAuthentication() public method

Set Digest Authentication
public setDigestAuthentication ( $username, $password = '' )
$username
$password
    public function setDigestAuthentication($username, $password = '')
    {
        $this->setOpt(CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
        $this->setOpt(CURLOPT_USERPWD, $username . ':' . $password);
    }

Usage Example

Example #1
0
 /**
  * Send digest authentication to the server via GET.
  *
  * @param  string $username
  * @param  string $password optional
  * @return string
  */
 public function sendDigestAuthentication($username, $password = null)
 {
     $this->client->setDigestAuthentication($username, $password);
     return $this->client->get($this->url);
 }