Checks a telephone number for validity.
If the service returns false, the supplied telephone number is invalid and cannot be called. If the service returns true, the telephone
number is likely to be valid. This does not necessarily mean that the number can be called and is owned by the expected person, but
does indicate that the number lies within a range of numbers that have been allocated for use.
This service is not appropriate if you require an absolute indication that a telephone number is valid for a particular individual. In
those circumstances, you should consider the use of a telephone number capture service.
However, this service does provide a quick and inexpensive method for preventing accidentally mis-typed numbers.
Language:
<!-- Import the Integr8 Ajax API -->
<!-- NOTE: Get your own API key to use in the following script tag from: -->
<!-- http://www.data-8.co.uk/integr8/Admin/Ajax.aspx -->
<script src="http://webservices.data-8.co.uk/Javascript/Loader.ashx?key=your-api-key" type="text/javascript">
</script>
<script type="text/javascript">
function loadIntegr8() {
// Load the TelephoneValidation Integr8 service
data8.load('TelephoneValidation');
}
function IsValid(number) {
/// <param name="number">string</param>
var telephonevalidation = new data8.telephonevalidation();
telephonevalidation.isvalid(
number,
null,
showIsValidResult
);
}
function showIsValidResult(result) {
// Check that the call succeeded, and show the error message if there was a problem.
if (!result.Status.Success) {
alert('Error: ' + result.Status.ErrorMessage);
}
else {
// TODO: Process method results here.
// Results can be extracted from the following fields:
// result.Result
// Indicates if the telephone number is found to be valid.
}
}
loadIntegr8();
</script>
// NOTE: A reference to the web service must be added in Visual Studio with the URL
// http://webservices.data-8.co.uk/TelephoneValidation.asmx
private void IsValid(string number)
{
// Invoke the web service method.
TelephoneValidation proxy = new TelephoneValidation();
TelephoneValidationOutput results = proxy.IsValid("username", "password", number, null);
// Check that the call succeeded, and show the error message if there was a problem.
if ((results.Status.Success == false))
{
MessageBox.Show(("Error: " + results.Status.ErrorMessage));
}
else
{
// TODO: Process method results here.
// Results can be extracted from the following fields:
// result.Result
// Indicates if the telephone number is found to be valid.
}
}
'NOTE: A reference to the web service must be added in Visual Studio with the URL
'http://webservices.data-8.co.uk/TelephoneValidation.asmx
Private Sub IsValid(ByVal number As String)
'Invoke the web service method.
Dim proxy As TelephoneValidation = New TelephoneValidation()
Dim results As TelephoneValidationOutput = proxy.IsValid("username", "password", number, Nothing)
'Check that the call succeeded, and show the error message if there was a problem.
If (results.Status.Success Is false) Then
MessageBox.Show(("Error: " + results.Status.ErrorMessage))
Else
'TODO: Process method results here.
'Results can be extracted from the following fields:
'result.Result
' Indicates if the telephone number is found to be valid.
End If
End Sub
Public Sub IsValid(number As String)
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "http://webservices.data-8.co.uk/recordset.ashx?service=TelephoneValidation&method=IsValidSimple" &
"&username=your-username" &
"&password=your-password" &
"&number=" & number
If rs.MoveFirst Then
If rs.Fields(0).Name = "Success" And rs.Fields(0).Value = false Then
MsgBox "Error: " & rs.Fields(1)
Else
'TODO: Process method results here.
'All the results are available in the first row in the recordset.
'Results can be extracted from the following fields:
'Result
' Indicates if the telephone number is found to be valid.
End If
End If
End Sub
// NOTE: The php_soap.dll extension must be enabled in the php.ini file.
function IsValid($number)
{
$params = array(
"username" => "your-username",
"password" => "your-password",
"number" => $number,
"options" => $options
);
$client = new SoapClient("http://webservices.data-8.co.uk/TelephoneValidation.asmx?WSDL");
$result = $client->IsValid($params);
if ($result->IsValidResult->Status->Success == 0)
{
echo "Error: " . $result->IsValidResult->Status->ErrorMessage;
}
else
{
// TODO: Process method results here.
// Results can be extracted from the following fields:
// $result->IsValidResult->Result
// Indicates if the telephone number is found to be valid.
}
}