GET Phone number information & phone number score via API:


API Features:

  • Look up phone number 
  • GET phone number score against TelecomsXChange database (Good Number or Risky)


GOOD: the number has been recorded in our database and had high durations and most probably a good number that belongs to a real person.


RISKY: We have never seen this number before or it had too many failed calls that never connected.


Use Cases:

  • Build Whitelist/Blacklist systems through API
  • Decrease SPAM/ROBO incoming calls
  • Decrease Sim blockage 
  • Reject the risky phone numbers calls before it hits your infrastructure



Code Samples:



<?php

// my login in TCXC
$api_login ="ENTER BUYER USERNAME HERE";

//my API key
$api_key = "ENTER API KEY HERE";

// initialising CURL - Make sure you have php-curl module installed
$ch = curl_init();

//controller is a script name, so in case lookup.php controller is lookup
$controller = "whitelist";

//unix timestamp to ensure that signature will be valid temporary
$ts = time();

//compose signature concatenating controller api_key api_login and unix timestamp
$signature = hash( 'sha256', $controller .  $api_key   . $api_login  . $ts);

$params = array(
                'ts' => $ts,  //provide TS
                'signature' => $signature,
                'webapi'    => 1,
                'api_login' => $api_login,
                'number' => '380913100703', // same parameters as web portal accepts
                //...

                );


//query against api. URL
curl_setopt($ch, CURLOPT_URL,"https://members.telecomsxchange.com/$controller.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec ($ch);
curl_close ($ch);

//analyze JSON output
echo "server_output:$server_output";


?>



Response: 


JSON output:

{
    "status": "success",
    "country_code": "ua",
    "phone_number": "+380913104703",
    "carrier": {
        "country_code": "ua",
        "country_name": "Ukraine",
        "description": "Ukr Telecom Mobile",
        "prefix": "38091",
        "number_score": "Risky number"
    }
}