שירות GetCountries REST/JSON

פונקציה זו תחזיר רשימה בפורמט JSON של מדינות שבהן ניתן לרכוש מספרים

מטא:

GetCountries(Username, Password)

דוגמת שימוש:

POST:

curl -X POST https://api.multitel.net/json/getcountries \
--data-urlencode "UserName=MyUsername" \
--data-urlencode "Password=MyPassword"

GET:

curl -X GET https://api.multitel.net/json/getcountries/MyUsername/MyPassword

ניתן להשתמש גם בדוגמה שלהלן

<?php
  $server_url = 'https://api.multitel.net/json/getcountries/
  // additionally you can call it via GET -- https://api.multitel.net/json/getcountries/USERNAME/PASSWORD

  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" value="administrator" />
      <br />
      Password : <input type="text" name="password" value="password" />
      <br />
      <input type="submit" name="submit" value="submit" />
    </form>
  </body>
</html>

דוגמת קוד · הצג מקור

התוצאה תהיה:

{"output":
   [
    {
      "COUNTRYCODE":"1",
      "DESCRIPTION":"Jamaica",
      "COUNTRYID":"104",
      "ISOCODE":"JAM",
      "A2B":"106",
      "LATITUDE":"18.304988",
      "LONGITUDE":"-77.690048"
    },{
      "COUNTRYCODE":"1",
      "DESCRIPTION":"USA",
      "COUNTRYID":"211",
      "ISOCODE":"USA",
      "A2B":"225",
      "LATITUDE":"38.889747",
      "LONGITUDE":"-77.025599"
    },{
      "COUNTRYCODE":"1",
      "DESCRIPTION":"Dominican Republic",
      "COUNTRYID":"224",
      "ISOCODE":"DOM",
      "A2B":"61",
      "LATITUDE":"19.103648",
      "LONGITUDE":"-71.340637"
    }, --- and so on

דוגמת קוד · הצגת המקור

חפש תיעוד