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 TelephoneDirectory Integr8 service
data8.load('TelephoneDirectory');
}
function DirectoryLookup(name, postcode, town) {
/// <param name="name">data8.name. Set up the Title, Forename, MiddleName, Surname properties before calling this method.</param>
/// <param name="postcode">string</param>
/// <param name="town">string</param>
var telephonedirectory = new data8.telephonedirectory();
telephonedirectory.directorylookup(
name,
postcode,
town,
null,
showDirectoryLookupResult
);
}
function showDirectoryLookupResult(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.Results
// Contains an array of results from the telephone directory for the requested search.
// Each item in the array contains TelephoneNumber, Name and Address fields which
// allow the extraction of the required details of each match.
}
}
loadIntegr8();
</script>
// NOTE: A reference to the web service must be added in Visual Studio with the URL
// http://webservices.data-8.co.uk/TelephoneDirectory.asmx
private void DirectoryLookup(Name name, string postcode, string town)
{
// Invoke the web service method.
TelephoneDirectory proxy = new TelephoneDirectory();
TelephoneDirectoryOutput results = proxy.DirectoryLookup("username", "password", name, postcode, town, 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.Results
// Contains an array of results from the telephone directory for the requested search.
// Each item in the array contains TelephoneNumber, Name and Address fields which
// allow the extraction of the required details of each match.
}
}
'NOTE: A reference to the web service must be added in Visual Studio with the URL
'http://webservices.data-8.co.uk/TelephoneDirectory.asmx
Private Sub DirectoryLookup(ByVal name As Name, ByVal postcode As String, ByVal town As String)
'Invoke the web service method.
Dim proxy As TelephoneDirectory = New TelephoneDirectory()
Dim results As TelephoneDirectoryOutput = proxy.DirectoryLookup("username", "password", name, postcode, town, 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.Results
' Contains an array of results from the telephone directory for the requested search.
' Each item in the array contains TelephoneNumber, Name and Address fields which
' allow the extraction of the required details of each match.
End If
End Sub
Public Sub DirectoryLookup(forename As String, middleName As String, surname As String, postcode As String, town As String)
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "http://webservices.data-8.co.uk/recordset.ashx?service=TelephoneDirectory&method=DirectoryLookupSimple" &
"&username=your-username" &
"&password=your-password" &
"&forename=" & forename &
"&middleName=" & middleName &
"&surname=" & surname &
"&postcode=" & postcode &
"&town=" & town
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.
'Each result is available in a different row in the recordset.
'Results can be extracted from the following fields:
'TelephoneNumber
'Name_Title
'Name_Forename
'Name_MiddleName
'Name_Surname
End If
End If
End Sub
// NOTE: The php_soap.dll extension must be enabled in the php.ini file.
function DirectoryLookup($name, $postcode, $town)
{
$params = array(
"username" => "your-username",
"password" => "your-password",
"name" => $name,
"postcode" => $postcode,
"town" => $town,
"options" => $options
);
$client = new SoapClient("http://webservices.data-8.co.uk/TelephoneDirectory.asmx?WSDL");
$result = $client->DirectoryLookup($params);
if ($result->DirectoryLookupResult->Status->Success == 0)
{
echo "Error: " . $result->DirectoryLookupResult->Status->ErrorMessage;
}
else
{
// TODO: Process method results here.
// Results can be extracted from the following fields:
// $result->DirectoryLookupResult->Results
// Contains an array of results from the telephone directory for the requested search.
// Each item in the array contains TelephoneNumber, Name and Address fields which
// allow the extraction of the required details of each match.
// NOTE: This field contains an array of items, but if it contains only one item,
// PHP may not recognise it as an array. To always extract the result of this
// field as an array, we recommend you always access it using the
// getArrayFromResponse method described at
// http://www.php.net/soap_soapclient_soapcall#75797, e.g.
// foreach (getArrayFromResponse($result->DirectoryLookupResult->Results) as $item)
// {
// ...
// }
}
}