Checks if the telephone number is registered with the CTPS, and so cannot be called for unsolicited direct marketing. If the number can be called for marketing purposes, the Callable field of the CTPSOutput structure returned by the service will be set to true. Otherwise, it will be set to false. In either case, the TelephoneNumber field of the structure will be set to the same value as was supplied as the number parameter.
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 CTPS Integr8 service
data8.load('CTPS');
}
function IsCallable(number) {
/// <param name="number">string</param>
var ctps = new data8.ctps();
ctps.iscallable(
number,
null,
showIsCallableResult
);
}
function showIsCallableResult(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.Callable
// Indicates if the supplied telephone number is callable (i.e. not on the CTPS)
// result.TelephoneNumber
// Contains the original telephone number if it is callable.
}
}
loadIntegr8();
</script>
// NOTE: A reference to the web service must be added in Visual Studio with the URL
// http://webservices.data-8.co.uk/CTPS.asmx
private void IsCallable(string number)
{
// Invoke the web service method.
CTPS proxy = new CTPS();
CTPSOutput results = proxy.IsCallable("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.Callable
// Indicates if the supplied telephone number is callable (i.e. not on the CTPS)
// result.TelephoneNumber
// Contains the original telephone number if it is callable.
}
}
'NOTE: A reference to the web service must be added in Visual Studio with the URL
'http://webservices.data-8.co.uk/CTPS.asmx
Private Sub IsCallable(ByVal number As String)
'Invoke the web service method.
Dim proxy As CTPS = New CTPS()
Dim results As CTPSOutput = proxy.IsCallable("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.Callable
' Indicates if the supplied telephone number is callable (i.e. not on the CTPS)
'result.TelephoneNumber
' Contains the original telephone number if it is callable.
End If
End Sub
Public Sub IsCallable(number As String)
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "http://webservices.data-8.co.uk/recordset.ashx?service=CTPS&method=IsCallableSimple" &
"&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:
'Callable
' Indicates if the supplied telephone number is callable (i.e. not on the CTPS)
'TelephoneNumber
' Contains the original telephone number if it is callable.
End If
End If
End Sub
// NOTE: The php_soap.dll extension must be enabled in the php.ini file.
function IsCallable($number)
{
$params = array(
"username" => "your-username",
"password" => "your-password",
"number" => $number,
"options" => $options
);
$client = new SoapClient("http://webservices.data-8.co.uk/CTPS.asmx?WSDL");
$result = $client->IsCallable($params);
if ($result->IsCallableResult->Status->Success == 0)
{
echo "Error: " . $result->IsCallableResult->Status->ErrorMessage;
}
else
{
// TODO: Process method results here.
// Results can be extracted from the following fields:
// $result->IsCallableResult->Callable
// Indicates if the supplied telephone number is callable (i.e. not on the CTPS)
// $result->IsCallableResult->TelephoneNumber
// Contains the original telephone number if it is callable.
}
}