Example #1
0
 $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();
 $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());
Example #2
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;
}