$data = array(); // +-----------------------------------+ // + STEP 2: get data + // +-----------------------------------+ $token = $_REQUEST['access_token']; if (!$token) { $success = "0"; $msg = "Incomplete Parameters"; $data = array(); } else { // +-----------------------------------+ // + STEP 3: perform operations + // +-----------------------------------+ $uid = GeneralFunctions::getUserId($token); if ($uid) { $data = GeneralFunctions::get_notifications($uid); if ($data) { $success = "1"; $msg = "Records Found"; } else { $success = '0'; $msg = "No Record Found"; } } else { $success = '0'; $msg = "Incorrect Parameters"; } } // +-----------------------------------+ // + STEP 4: send json data + // +-----------------------------------+