This API validates phone numbers (only Republic of Moldova) in several valid formats and returns the mobile carrier name.
The API uses GET method to send request. Below you can find sample synax.
GET
https://apineo.app/phone-validation/?phone_number=037379528887
Below you can find a "valid" response sample.
GET
https://apineo.app/phone-validation/?phone_number=037379528887
{
"success": true,
"result": "valid",
"number": "037379528887",
"carrier": "Moldcell",
"country_code": "MD",
"execution_time_spent": 0.00012493133544921875
}
Below you can find an "invalid" response sample.
GET
https://apineo.app/phone-validation/?phone_number=037279528887
{
"success": true,
"result": "invalid",
"number": "037279528887",
"info": "Only valid Moldova (Republic of) phone numbers are allowed.",
"valid_format_examples": [
"79515556",
"079515556",
"+37379515556",
"+373079515556",
"0373079515556",
"037379515556",
"022665599",
"023528659",
"+37323528659",
"037323528659"
],
"execution_time_spent": 0.0002689361572265625
}
Below you can find an "error" response.
GET
https://apineo.app/phone-validation/?phone
{
"success": false,
"error": "Error. You must provide a phone number.",
"valid_syntax_example": "https://apineo.app/phone-validation/?phone_number=+37379528887",
"info": "Only valid Moldova (Republic of) phone numbers are allowed.",
"valid_format_examples": [
"79515556",
"079515556",
"+37379515556",
"+373079515556",
"0373079515556",
"037379515556",
"022665599",
"023528659",
"+37323528659",
"037323528659"
],
"execution_time_spent": 7.0810317993164062e-5
}
Below you can find a usage sample php code using cURL.
<?php
//Validation function using cURL
function validate_phone($phone_number){
$ch = curl_init("https://apineo.app/phone-validation/?phone_number=".$phone_number."");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec($ch);
curl_close($ch);
$validationResult = json_decode($json, true);
if($validationResult["result"]=="valid"){
return true;
}else{
return false;
}
}
//USAGE
if(validate_phone("037379528887")){
//do success code ...
}else{
//do error code ...
}
?>