From c6c584ba403c684bd6bb57a23251f006e9c92d97 Mon Sep 17 00:00:00 2001 From: mgp25 Date: Wed, 2 Sep 2015 19:43:01 +0200 Subject: [PATCH] Exit if account has problems --- src/snapchat_agent.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/snapchat_agent.php b/src/snapchat_agent.php index 12bd02a..004d40b 100644 --- a/src/snapchat_agent.php +++ b/src/snapchat_agent.php @@ -432,6 +432,12 @@ public function post($endpoint, $data, $params, $multipart = FALSE, $debug = FAL if($endpoint == "/loq/login" || $endpoint == "/all_updates") { + if (strpos($result,'401 UNAUTHORIZED') !== false) + { + echo "\nRESULT: 401 UNAUTHORIZED\n"; + exit(); + } + $jsonResult = json_decode($result); echo 'RESULT: ' . print_r($jsonResult) . "\n"; if (property_exists($jsonResult, "status") && $jsonResult->status == '-103')