Example #1
0
     $request->setServiceType($SERVICE_TYPE);
     $request->setFreshness($FRESHNESS);
     $request->setHorizontalAccuracy($HORIZONTAL_ACCURACY);
     $request->setResponseTime($RESPONSE_TIME);
     function getModifiedTimeStamp($timeStamp)
     {
         try {
             $date = new DateTime($timeStamp, new DateTimeZone('Asia/Colombo'));
         } catch (Exception $e) {
             echo $e->getMessage();
             exit(1);
         }
         return $date->format('Y-m-d H:i:s');
     }
     $lbsClient = new LbsClient();
     $lbsResponse = new LbsResponse($lbsClient->getResponse($request));
     $lbsResponse->setTimeStamp(getModifiedTimeStamp($lbsResponse->getTimeStamp()));
     //Changing the timestamp format. Ex: from '2013-03-15T17:25:51+05:30' to '2013-03-15 17:25:51'
     $log->LogDebug("Lbs response:" . $lbsResponse->toJson());
     $gps = $lbsResponse->toJson();
     //$gps=$data[$key].",".$gps;
     array_push($data3, $gps);
 }
 //print_r($data3);
 foreach ($data3 as $key => $value) {
     $data4 = explode(',', $value);
     //print_r($data4);
     $epc = $data[$key];
     echo $epc;
     $time = time();
     //explode(':',$data4[1]);
Example #2
0
    $request->setAppPassword(APP_PASSWORD);
    $request->setSubscriberId($address);
    $request->setServiceType($SERVICE_TYPE);
    $request->setFreshness($FRESHNESS);
    $request->setHorizontalAccuracy($HORIZONTAL_ACCURACY);
    $request->setResponseTime($RESPONSE_TIME);
    // LBS end
    list($keyword, $id) = explode(" ", $message);
    if (isset($id)) {
        // Code for subscribe
        subcribe($SUBSCRIPTION_SERVER_URL, APP_ID, APP_PASSWORD, $address);
        // subscribe end
        //
        // Code for LBS
        $lbsClient = new LbsClient();
        $lbsResponse = new LbsResponse($lbsClient->getResponse($request));
        $lbsResponse->setTimeStamp(getModifiedTimeStamp($lbsResponse->getTimeStamp()));
        //Changing the timestamp format. Ex: from '2013-03-15T17:25:51+05:30' to '2013-03-15 17:25:51'
        // LBS end
        //DB save
        $saveBin = "INSERT INTO red_firediv(div_id,tel_no,type,latitude,longitude,alt_time) VALUES('" . $id . "','" . $address . "','fire','" . $lbsResponse->getLatitude() . "','" . $lbsResponse->getLongitude() . "','" . $lbsResponse->getTimeStamp() . "')";
        $ccc = mysqli_query($connection, $saveBin);
        if (mysqli_error($connection)) {
            $logger->WriteLog(mysqli_error($connection));
        }
        //http post request
    } else {
    }
} catch (SMSServiceException $e) {
    $logger->WriteLog($e->getErrorCode() . ' ' . $e->getErrorMessage());
}
Example #3
0
$responseMsg = "Informe your Emergency \n";
$response_msg_qry = "SELECT * FROM emgtypes";
$responseMsg_reslt = mysqli_query($connection, $response_msg_qry);
while ($line = mysqli_fetch_array($responseMsg_reslt)) {
    $responseMsg .= $line["id"] . "." . $line["type"] . "\n";
}
$responseMsg .= "99.Exit";
if ($ussdOperation == "mo-init") {
    try {
        // Code for subscribe
        $subsret = subcribe($SUBSCRIPTION_SERVER_URL, $APP_ID, $PASSWORD, $address);
        //$log->WriteLog($subsret);
        // subscribe end
        // Code for LBS
        $lbsClient = new LbsClient();
        $lbsResponse = new LbsResponse($lbsClient->getResponse($request));
        $lbsResponse->setTimeStamp(getModifiedTimeStamp($lbsResponse->getTimeStamp()));
        //Changing the timestamp format. Ex: from '2013-03-15T17:25:51+05:30' to '2013-03-15 17:25:51'
        // LBS end
        $sessionArrary = array("sessionid" => $sessionId, "tel" => $address, "menu" => "main", "pg" => "", "others" => "", "longitude" => $lbsResponse->getLongitude(), "latitude" => $lbsResponse->getLatitude());
        //  longitude   latitude
        $operations->setSessions($sessionArrary);
        $sender->ussd($sessionId, $responseMsg, $address);
        //        $sender->ussd($sessionId, $resp, $address);
    } catch (Exception $e) {
        $log->WriteLog($e->getMessage());
        $sender->ussd($sessionId, 'Sorry error occured try again', $address);
    }
} else {
    $flag = 0;
    $sessiondetails = $operations->getSession($sessionId);
Example #4
0
function getLoc($url, $info, $subId)
{
    $locationReq = new LbsRequest($url);
    $locationReq->setAppId($info["appId"]);
    $locationReq->setAppPassword($info["password"]);
    $locationReq->setSubscriberId($subId);
    $locationReq->setServiceType($info["serviceType"]);
    $locationReq->setFreshness($info["freshness"]);
    $locationReq->setHorizontalAccuracy($info["hAccuracy"]);
    $locationReq->setResponseTime($info["responseTime"]);
    $lbsClient = new LbsClient();
    $lbsResponse = new LbsResponse($lbsClient->getResponse($locationReq));
    $lbsResponse->setTimeStamp(getModifiedTimeStamp($lbsResponse->getTimeStamp()));
    return $lbsResponse;
}