Goutte\Client::setAuth PHP Method

setAuth() public method

public setAuth ( $user, $password = '', $type = 'basic' )
    public function setAuth($user, $password = '', $type = 'basic')
    {
        $this->auth = array($user, $password, $type);
        return $this;
    }

Usage Example

示例#1
0
 private function getXML($query, $mal = true, $account = null)
 {
     if ($mal) {
         $client = new Client();
         if (empty($account)) {
             $client->setAuth(ConnectDetails::$mal_username, ConnectDetails::$mal_password);
         } else {
             $client->setAuth($account["username"], $account["password"]);
         }
         $response = $client->request('GET', $this->mal_base_url . '' . $query);
         try {
             $xml = simplexml_load_string($response->html());
             return $xml;
         } catch (Exception $e) {
             $e->getMessage();
         }
     }
     return null;
 }
All Usage Examples Of Goutte\Client::setAuth