Skip to content

Instantly share code, notes, and snippets.

@multitel
Created October 28, 2014 13:37
Show Gist options
  • Save multitel/0aaeb081b02574f95c49 to your computer and use it in GitHub Desktop.
Save multitel/0aaeb081b02574f95c49 to your computer and use it in GitHub Desktop.
<?php
$server_url = 'https://sapi.multitel.net/json/getcountries';
if(isset($_POST['submit'])) {
$data = array(
'UserName' => $_POST['username'],
'Password' => $_POST['password']
);
$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>GetCountries JSON</title>
</head>
<body>
<form name="form1" method="POST" action="">
Username : <input type="text" name="username"/>
<br />
Password : <input type="text" name="password"/>
<br />
<input type="submit" name="submit" value="submit" />
</form>
</body>
</html>
@multitel
Copy link
Author

Sample output:

{"DATA":[{"COUNTRYCODE":"244","DESCRIPTION":"Angola","COUNTRYID":"244","ISOCODE":"AGO","A2B":"6","LATITUDE":"-12.35","LONGITUDE":"17.35"}, .....]}

@multitel
Copy link
Author

Please use COUNTRYCODE and COUNTRYID as parameters for the GetAreas function : https://gist.github.com/multitel/8d0ce0f9cd73bb74db93

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment