Last active
September 14, 2022 05:18
-
-
Save unwiredlabs/6081175 to your computer and use it in GitHub Desktop.
This script is a demo on how to use LocationAPI.org's Mobile Triangulation API v2.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Sample script to test Unwired Labs Geolocation API v2 | |
* | |
* Created: 20th July, 2013 | |
* Author: Unwired Labs | |
* | |
*/ | |
// The data to send to the API | |
$postData = Array | |
( | |
"token" => "your_token", | |
"radio"=>"gsm", | |
"mcc" => "310", | |
"mnc" => "410", | |
"cells" => Array | |
( | |
"0" => Array | |
( | |
"lac" => "7033", | |
"cid" => "17811", | |
), | |
"1" => Array | |
( | |
"lac" => "7033", | |
"cid" => "17812", | |
), | |
"2" => Array | |
( | |
"lac" => "7033", | |
"cid" => "18513", | |
) | |
) | |
); | |
// Setup cURL | |
$ch = curl_init('http://us1.unwiredlabs.com/v2/process.php'); | |
curl_setopt_array($ch, array( | |
CURLOPT_POST => TRUE, | |
CURLOPT_RETURNTRANSFER => TRUE, | |
CURLOPT_HTTPHEADER => array( | |
'Content-Type: application/json' | |
), | |
CURLOPT_POSTFIELDS => json_encode($postData) | |
)); | |
// Send the request | |
$response = curl_exec($ch); | |
// Check for errors | |
if ($response === FALSE) { | |
die(curl_error($ch)); | |
} | |
print_r($response); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello @LocationAPI, I'd like to contribute a little script in python to query your wonderful service
example usage:
locationapi.py