/** * * Login to Instagram with Credentials * * @param $username string Instagram Username * @param $password string Instagram Password * @return API\Response\LoginResponse * @throws Exception */ public function login($username, $password) { $this->setupAsNewDevice(); $this->setDeviceId($this->generateDeviceId(md5($username . $password))); $request = new LoginRequest($this, $username, $password); $response = $request->execute(); if (!$response->isOk()) { if ($response->isCheckpointRequired()) { throw new InstagramException(sprintf("Login Failed: [%s] %s\nGo to this URL in your web browser to continue:\n%s", $response->getStatus(), $response->getMessage(), $response->getCheckpointUrl())); } throw new InstagramException(sprintf("Login Failed: [%s] %s", $response->getStatus(), $response->getMessage())); } $this->setLoggedInUser($response->getLoggedInUser()); return $response; }
/** * * Login to Instagram with Credentials * * @param $username string Instagram Username * @param $password string Instagram Password * @return API\Response\LoginResponse * @throws Exception */ public function login($username, $password) { $this->setupAsNewDevice(); $this->setDeviceId($this->generateDeviceId(md5($username . $password))); $request = new LoginRequest($this, $username, $password); $response = $request->execute(); if (!$response->isOk()) { throw new InstagramException(sprintf("Login Failed: [%s] %s", $response->getStatus(), $response->getMessage())); } $this->setLoggedInUser($response->getLoggedInUser()); return $response; }