Number Verifier
PHP

Introduction

The NumberValidation API validates any phonenumber.

It will tell you the formatting options and type of the number, and will determine the most likely carrier.

There are a few optional parameters available:
The mnp_lookup parameter (boolean) forces our system to look up the number in our Portability databases to provide a carrier as accurately as possible.
And the responsetype parameter (int) determines what properties are available in the returned object.

Authentication

Your product-token authenticates your calls.

Provide it in the X-CM-PRODUCTTOKEN header for authentication.

Number Validation

The default Number Validation resource validates one phonenumber at a time.

Mobile Number Portability lookup is turned on by default to provide carrier determination that is as accurate as possible.

using GET

https://api.cmtelecom.com/v1.1/numbervalidation/{phonenumber}

Send one request with a phonenumber in the url, and receive the validation information as JSON object.

GET Parameters

name in required schema
X-CM-PRODUCTTOKEN header true 0000000-0000-0000-0000-000000000000
phonenumber path true 0031687654321
mnp_lookup query false true (default)
responsetype query false 1

Responses

http status content-type description
200 application/json {
  • "carrier": "Lycamobile",
  • "country_code": 31,
  • "country_iso": "NL",
  • "format_e164": "+31687654321",
  • "format_international": "+31 6 87654321",
  • "format_national": "06 87654321",
  • "region": Netherlands",
  • "region_code": "NL",
  • "timezone": [
    • "Europe/Amsterdam"
    ],
  • "type": {
    • "mobile": true,
    • "fixed_line": false,
    • "fixed_line_or_mobile": false,
    • "voip": false,
    • "toll_free": false,
    • "premium_rate": false,
    • "standard_rate": false,
    • "shared_cost": false,
    • "personal": false,
    • "pager": false,
    • "voicemail": false,
    • "shortcode": false,
    • "emergency": false,
    • "unknown": false
    },
  • "valid_number": true
}

Code Examples:

CURL
curl -i https://api.cmtelecom.com/v1.1/numbervalidation/0031687654321
     -H "X-CM-PRODUCTTOKEN: 0000000-0000-0000-0000-000000000000"
PHP
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $data = json_encode(array("phonenumber" => "string"));

  $url = 'https://api.cmtelecom.com/v1.1/numbervalidation/0031687654321';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'X-CM-PRODUCTTOKEN: 0000000-0000-0000-0000-000000000000'
                                 ),
     CURLOPT_HEADER         => TRUE,
     CURLOPT_RETURNTRANSFER => TRUE
    )
  );

  $result = curl_exec($ch);

  var_dump($result);
  
  curl_close($ch);

using POST

https://api.cmtelecom.com/v1.1/numbervalidation

Send one JSON object with a phonenumber property, and receive the validation information as JSON object.

POST Parameters

name in required schema
X-CM-PRODUCTTOKEN header true 0000000-0000-0000-0000-000000000000
object body true {"phonenumber" : "string"}
object body false {"mnp_lookup" : true} (default)
object body false {"responsetype" : 1} (default)

Responses

http status content-type description
200 application/json {
  • "carrier": "Lycamobile",
  • "country_code": 31,
  • "country_iso": "NL",
  • "format_e164": "+31687654321",
  • "format_international": "+31 6 87654321",
  • "format_national": "06 87654321",
  • "region": Netherlands",
  • "region_code": "NL",
  • "timezone": [
    • "Europe/Amsterdam"
    ],
  • "type": {
    • "mobile": true,
    • "fixed_line": false,
    • "fixed_line_or_mobile": false,
    • "voip": false,
    • "toll_free": false,
    • "premium_rate": false,
    • "standard_rate": false,
    • "shared_cost": false,
    • "personal": false,
    • "pager": false,
    • "voicemail": false,
    • "shortcode": false,
    • "emergency": false,
    • "unknown": false
    },
  • "valid_number": true
}

Code Examples:

cURL
curl -i https://api.cmtelecom.com/v1.1/numbervalidation
     -X POST
     -H "Content-Type: application/json"
     -H "X-CM-PRODUCTTOKEN: 0000000-0000-0000-0000-000000000000"
     -d '{"phonenumber": "string"}'
PHP
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $data = json_encode(array("phonenumber" => "string"));

  $url = 'https://api.cmtelecom.com/v1.1/numbervalidation';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json',
                                 'X-CM-PRODUCTTOKEN: 0000000-0000-0000-0000-000000000000'
                                 ),
     CURLOPT_HEADER         => TRUE,
     CURLOPT_POST           => TRUE,
     CURLOPT_POSTFIELDS     => $data,
     CURLOPT_RETURNTRANSFER => TRUE
    )
  );

  $result = curl_exec($ch);

  var_dump($result);
  
  curl_close($ch);

Number Lookup

The Lookup method in the Number Verifier API will look up additional information for the given phonenumber.

Information like the Portation-state, the actual operator, if the number is roaming and even if the number is active on the network.

Collecting this data is not free, and you must contact your account manager before you can use this resource.

using GET

https://api.cmtelecom.com/v1.1/numberlookup/{phonenumber}

Send one request with a phonenumber in the url, and receive the validation information as JSON object, enriched with properties provided by the lookup result.

GET Parameters

name in required schema
X-CM-PRODUCTTOKEN header true 0000000-0000-0000-0000-000000000000
phonenumber path true 0031687654321
mnp_lookup query false false (default)
responsetype query false 2 (default)

Responses

http status content-type description
200 application/json {
  • "active_number": false,
  • "carrier": "Lycamobile",
  • "carrier_mcc": 204,
  • "carrier_mnc": 09,
  • "country_code": 31,
  • "country_iso": "NL",
  • "format_e164": "+31687654321",
  • "format_international": "+31 6 87654321",
  • "format_national": "06 87654321",
  • "ported": false,
  • "region": Netherlands",
  • "region_code": "NL",
  • "roaming": false,
  • "roaming_country_iso": "NL",
  • "roaming_country_prefix": 31,
  • "roaming_carrier": "Lycamobile",
  • "roaming_mcc": 204,
  • "roaming_mnc": 09,
  • "timezone": [
    • "Europe/Amsterdam"
    ],
  • "type": {
    • "mobile": true,
    • "fixed_line": false,
    • "fixed_line_or_mobile": false,
    • "voip": false,
    • "toll_free": false,
    • "premium_rate": false,
    • "standard_rate": false,
    • "shared_cost": false,
    • "personal": false,
    • "pager": false,
    • "voicemail": false,
    • "shortcode": false,
    • "emergency": false,
    • "unknown": false
    },
  • "valid_number": true
}

Code Examples:

CURL
curl -i https://api.cmtelecom.com/v1.1/numberlookup/0031687654321
     -H "X-CM-PRODUCTTOKEN: 0000000-0000-0000-0000-000000000000"
PHP
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $data = json_encode(array("phonenumber" => "string"));

  $url = 'https://api.cmtelecom.com/v1.1/numberlookup/0031687654321';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'X-CM-PRODUCTTOKEN: 0000000-0000-0000-0000-000000000000'
                                 ),
     CURLOPT_HEADER         => TRUE,
     CURLOPT_RETURNTRANSFER => TRUE
    )
  );

  $result = curl_exec($ch);

  var_dump($result);
  
  curl_close($ch);
using POST

https://api.cmtelecom.com/v1.1/numberlookup

Send one JSON object with a phonenumber property, and receive the validation information as JSON object, enriched with properties provided by the lookup result.

POST Parameters

name in required schema
X-CM-PRODUCTTOKEN header true 0000000-0000-0000-0000-000000000000
object body true {"phonenumber" : "string"}
object body false {"mnp_lookup": false} (default)
object body false {"responsetype": 2} (default)

Responses

http status content-type description
200 application/json {
  • "active_number": false,
  • "carrier": "Lycamobile",
  • "carrier_mcc": 204,
  • "carrier_mnc": 09,
  • "country_code": 31,
  • "country_iso": "NL",
  • "format_e164": "+31687654321",
  • "format_international": "+31 6 87654321",
  • "format_national": "06 87654321",
  • "ported": false,
  • "region": Netherlands",
  • "region_code": "NL",
  • "roaming": false,
  • "roaming_country_iso": "NL",
  • "roaming_country_prefix": 31,
  • "roaming_carrier": "Lycamobile",
  • "roaming_mcc": 204,
  • "roaming_mnc": 09,
  • "timezone": [
    • "Europe/Amsterdam"
    ],
  • "type": {
    • "mobile": true,
    • "fixed_line": false,
    • "fixed_line_or_mobile": false,
    • "voip": false,
    • "toll_free": false,
    • "premium_rate": false,
    • "standard_rate": false,
    • "shared_cost": false,
    • "personal": false,
    • "pager": false,
    • "voicemail": false,
    • "shortcode": false,
    • "emergency": false,
    • "unknown": false
    },
  • "valid_number": true
}

Code Examples:

CURL
curl -i https://api.cmtelecom.com/v1.1/numberlookup
     -X POST
     -H "Content-Type: application/json"
     -H "X-CM-PRODUCTTOKEN: 0000000-0000-0000-0000-000000000000"
     -d '{"phonenumber": "string"}'
PHP
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $data = json_encode(array("phonenumber" => "string"));

  $url = 'https://api.cmtelecom.com/v1.1/numberlookup';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json',
                                 'X-CM-PRODUCTTOKEN: 0000000-0000-0000-0000-000000000000'
                                 ),
     CURLOPT_HEADER         => TRUE,
     CURLOPT_POST           => TRUE,
     CURLOPT_POSTFIELDS     => $data,
     CURLOPT_RETURNTRANSFER => TRUE
    )
  );

  $result = curl_exec($ch);

  var_dump($result);
  
  curl_close($ch);