Created
October 28, 2014 13:47
-
-
Save multitel/8d0ce0f9cd73bb74db93 to your computer and use it in GitHub Desktop.
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 | |
$server_url = 'https://sapi.multitel.net/json/getareas'; | |
if(isset($_POST['submit'])) { | |
$data = array( | |
'UserName' => $_POST['username'], | |
'Password' => $_POST['password'], | |
'CountryCode' => $_POST['country_code'], | |
'CountryID' => $_POST['country_id'], | |
); | |
$handle = curl_init($server_url); | |
curl_setopt($handle, CURLOPT_POST, true); | |
curl_setopt($handle, CURLOPT_POSTFIELDS, $data); | |
curl_exec($handle); | |
} | |
?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title>GetAreas</title> | |
</head> | |
<body> | |
<form name="form1" method="post" action=""> | |
Username : <input type="text" name="username" /> | |
<br /> | |
Password : <input type="text" name="password" /> | |
<br /> | |
Country Code : <input type="text" name="country_code" value="" /> | |
<br /> | |
Country ID : <input type="text" name="country_id" value="" /> | |
<br /> | |
<input type="submit" name="submit" value="submit" /> | |
</form> | |
</body> | |
</html> |
Sample output:
{"DATA":[{"AREACODE":"24422","DESCRIPTION":"Luanda","CLATITUDE":"-12.35","CLONGITUDE":"17.35","ALATITUDE":"-8.8383","ALONGITUDE":"13.2344"},
{"AREACODE":"2449","DESCRIPTION":"Angola Mobile","CLATITUDE":"-12.35","CLONGITUDE":"17.35","ALATITUDE":"-8.8383","ALONGITUDE":"13.2344"}
]}
Output explanation:
Areacode -- area code for this area
Description -- longer description
CLatitude - Country Latitude
CLongitude - Country Longitude
ALatitude - Area Latitude
ALongitude - Area Longitude
Use the AREACODE as parameter for the GetDIDs function:
https://gist.github.com/multitel/7ea2153c1a474b0ad980
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please note that CountryID is required for countries sharing the same code (US/Canada/Jamaica/Puerto Rico/etc).