Example #1
0
 /**
  * @param $username
  * @param $password
  * @return string
  */
 public function getAuthToken($username, $password)
 {
     $this->options['getAuthToken'] = ['name' => $username, 'password' => $password];
     $this->client->post($this->getServerUrl() . '/_session', 200, $this->getOptions());
     $headers = $this->client->getLastHeaders();
     $cookie = $headers['Set-Cookie'][0];
     list($tokenPart) = explode(';', $cookie);
     $tokenPart = explode('=', $tokenPart);
     return $tokenPart[1];
 }