Esempio n. 1
0
 public function getResponse(LbsRequest $request)
 {
     $this->log->LogDebug("Request: " . $request->toJson());
     $ch = curl_init($request->getServer());
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
     curl_setopt($ch, CURLOPT_POSTFIELDS, $request->toJson());
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     $response = curl_exec($ch);
     $this->log->LogDebug("Response:" . $response);
     curl_close($ch);
     return $response;
 }
Esempio n. 2
0
     }
 }
 $con->mysqlclose();
 $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);
         }
Esempio 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;
}