diff --git a/src/snapchat.php b/src/snapchat.php index 2c3d3af..f095e69 100755 --- a/src/snapchat.php +++ b/src/snapchat.php @@ -463,6 +463,15 @@ public function register($username, $password, $email, $birthday, $phone_verific } $this->auth_token = $result['data']->auth_token; + $auth = $this->getAuthToken(); + $this->totArray[1][$this->username] = array($auth, time()+(55*60)); + file_put_contents(__DIR__ . DIRECTORY_SEPARATOR . self::DATA_FOLDER . DIRECTORY_SEPARATOR . "auth-$this->username.dat", serialize($this->totArray)); + if($auth['error'] == 1) + { + return $auth; + } + parent::setGAuth($auth); + $timestamp = parent::timestamp(); parent::post( '/loq/register_username', @@ -474,6 +483,7 @@ public function register($username, $password, $email, $birthday, $phone_verific array( $this->auth_token, $timestamp, + $auth['auth'] ), $multipart = false, $debug = $this->debug diff --git a/src/snapchat_agent.php b/src/snapchat_agent.php index a385699..2379727 100644 --- a/src/snapchat_agent.php +++ b/src/snapchat_agent.php @@ -358,7 +358,7 @@ public function post($endpoint, $data, $params, $multipart = FALSE, $debug = FAL curl_setopt($ch, CURLINFO_HEADER_OUT, true); } - if($endpoint == "/loq/login") + if($endpoint == "/loq/login" || $endpoint == "/loq/register_username") { $headers = array_merge(self::$CURL_HEADERS, array( "X-Snapchat-Client-Auth-Token: Bearer {$params[2]}",