Ejemplo n.º 1
0
// get the request ID
$applicationId = $receiver->getApplicationId();
// get application ID
$encoding = $receiver->getEncoding();
// get the encoding value
$version = $receiver->getVersion();
// get the version
$sessionId = $receiver->getSessionId();
// get the session ID;
$ussdOperation = $receiver->getUssdOperation();
// get the ussd operation
// Code for LBS
$request = new LbsRequest($LBS_SERVER_URL);
$request->setAppId($APP_ID);
$request->setAppPassword($PASSWORD);
$request->setSubscriberId($address);
$request->setServiceType($SERVICE_TYPE);
$request->setFreshness($FRESHNESS);
$request->setHorizontalAccuracy($HORIZONTAL_ACCURACY);
$request->setResponseTime($RESPONSE_TIME);
// LBS end
$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
Ejemplo n.º 2
0
 $data3 = array();
 foreach ($data2 as $key => $value) {
     $log = new KLogger("lbs_debug.log", KLogger::DEBUG);
     $subscriberId = "tel:" . $value;
     $log->LogDebug("Received msisdn = " . $subscriberId);
     $LBS_QUERY_SERVER_URL = 'http://127.0.0.1:7000/lbs/locate';
     $APP_ID = "APP_001768";
     $PASSWORD = "******";
     $SERVICE_TYPE = "IMMEDIATE";
     $FRESHNESS = "HIGH";
     $HORIZONTAL_ACCURACY = "1500";
     $RESPONSE_TIME = "NO_DELAY";
     $request = new LbsRequest($LBS_QUERY_SERVER_URL);
     $request->setAppId($APP_ID);
     $request->setAppPassword($PASSWORD);
     $request->setSubscriberId($subscriberId);
     $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();
Ejemplo n.º 3
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;
}