/** * * Execute the Request * * @return LoginResponse the Login Response * @throws CasperException * @throws \Exception */ public function execute() { $this->clearHeaders(); $this->clearParams(); $login = $this->snapchat->getCasper()->getSnapchatIOSLogin($this->username, $this->password, $this->snapchat->getDeviceTokenIdentifier(), $this->snapchat->getDeviceTokenVerifier(), $this->pre_auth_token); $this->url = $login["url"]; foreach ($login["headers"] as $key => $value) { $this->addHeader($key, $value); } foreach ($login["params"] as $key => $value) { $this->addParam($key, $value); } $response = parent::execute(); if (!$response->isOK()) { throw new \Exception(sprintf("[%s] Login Failed!", $response->getCode())); } return $this->mapper->map($response->getData(), new LoginResponse()); }