array('default' => -1))); if (isset($_GET['lng'])) $_SESSION["LNG"] = $_GET['lng']; else $_SESSION["LNG"] = 2;//'en'; $result=false; if ($fn == 1) { //Данные GPS $file = fopen('./data/'.time().'_'.$object->imei.'_1.json','w'); fwrite($file, $HTTP_RAW_POST_DATA); fclose($file); $result=true; }elseif ($fn == 2){ //Данные датчиков $file = fopen('./data/'.time().'_'.$object->imei.'_2.json','w'); fwrite($file, $HTTP_RAW_POST_DATA); fclose($file); $result=true; } if($result){ $obj = new StdClass(); $obj->errorCode = 0; $obj->errorMessage = ''; $obj->data = array(); header('Content-Type: application/json'); header("Cache-Control: no-cache, must-revalidate"); echo json_encode($obj); }else{ $obj = new StdClass(); $obj->errorCode = 1; $obj->errorMessage = ''; $obj->data = array(); header('Content-Type: application/json'); header("Cache-Control: no-cache, must-revalidate"); echo json_encode($obj); }