This API that has been made to be used as a web service. It is .Net based and can be used by any application regardless of programing language. The service has two functions, GetResultByName and GetResultByNumber, and the return type of these functions is array of string type.
1) the function GetResultByName has the following declaration.
GetResultByName(firstname,lastname,city,state) as string()
this function has four parameters, firstname, lastname, city and state. Parameter "lastname" is an essential parameter that must be given. This function returns the address and the phone number of the owner of given details.
2) the function GetResultByNumber has the following declaration.
GetResultByNumber(num) as string()
this function has only one parameter "num". This function returns the Name and the address of the owner of given number.
Example 1) GetResultByName(firstname,lastname,city,state) as string
First Name: Adam [optional]
Last Name: Smith [mandatory]
City: [optional]
State: [optional]
the result will be the detail of the owner including the address and the phone number of the owner.
Example 2) GetResultByNumber(num) as string()
Number: 7134672333
the result will be the detail of the owner including the address and the phone number of the owner.
PHP Example: GetResultByNumber(num) as string()
include "Const.inc.php";
include "$INCLUDEPATH/ADb.inc.php";
include("lib/nusoap.php");
$area=$_POST['Area'];
$tel1=$_POST['Tel1'];
$tel2=$_POST['Tel2'];
$num = $area . $tel1 . $tel2;
$myADb = new ADb();
$firstname=Null;
$lastname=Null;
$address=Null;
$city=Null;
$state=Null;
$zip=Null;
$phone=Null;
$strSQL = "SELECT * FROM ReverseInfo WHERE Phone='$num'";
$Result = $myADb->ExecuteQuery($strSQL);
if ($Result->fields[7] == $num)
{
while(!$Result->EOF)
{
echo "firstname= " . $Result->fields[1] . "
";
echo "lastname= " . $Result->fields[2] . "
";
echo "address= " . $Result->fields[3] . "
";
echo "city= " . $Result->fields[4] . "
";
echo "state=" . $Result->fields[5] . "
";
echo "zip= " . $Result->fields[6] . "
";
echo "phone= " . $Result->fields[7] . "
";
$Result->MoveNext();
}
}
else
{
$wsdlURL = "http://dev4.tvpakistan.com/SearchService.asmx?wsdl";
$soap = new soapclient($wsdlURL, "wsdl");
if ($_POST)
{
$parameters['parameters']['num'] = $num;
$result = $soap->call("GetResultByNumber", $parameters);
if ($error=$soap->getError())
{
die($error);
}
if (is_null($result))
{
echo "Record not found";
exit;
}
//print_r($result);
/*echo $result['GetResultByNumberResult']['string'][0] . "
";
echo $result['GetResultByNumberResult']['string'][1] . "
";
echo $result['GetResultByNumberResult']['string'][2] . "
";
echo $result['GetResultByNumberResult']['string'][3] . "
";
echo $result['GetResultByNumberResult']['string'][4] . "
";
echo $result['GetResultByNumberResult']['string'][5] . "
";*/
if ($result['GetResultByNumberResult']['string'][0] == "-2")
{
$lastname = "";
echo "lastname= -Not Available-
";
}
else
{
$lastname = $result['GetResultByNumberResult']['string'][0];
$lastname = trim($lastname);
echo "last= " . $lastname . "
";
}
if ($result['GetResultByNumberResult']['string'][1] == "-2")
{
$firstname = "" ;
echo "firstname= -Not Available-
";
}
else
{
$firstname = $result['GetResultByNumberResult']['string'][1];
$firstname = trim($firstname);
echo "first= " . $firstname . "
";
}
if ($result['GetResultByNumberResult']['string'][2] == "-2")
{
$address = $result['GetResultByNumberResult']['string'][3] . ", " . $result['GetResultByNumberResult']['string'][4] ;
echo "address= " . $address . "
";
}
else
{
$address = $result['GetResultByNumberResult']['string'][2];
echo "address= " . $address . "
";
}
if ($result['GetResultByNumberResult']['string'][3] == "-2")
{
$city = "";
echo "city= -Not Available-
";
}
else
{
$city = $result['GetResultByNumberResult']['string'][3];
echo "city= " . $city . "
";
}
if ($result['GetResultByNumberResult']['string'][4] == "-2")
{
$state = "";
echo "State= -Not Availabale-
";
}
else
{
$state = $result['GetResultByNumberResult']['string'][4];
echo "State= " . $state . "
";
}
$name = $fname . $lname;
$insSQL = "INSERT INTO ReverseInfo(FirstName,LastName,Address,City,State,Phone)
VALUES('$firstname','$lastname','$address','$city','$state','$num')";
$Result = $myADb->ExecuteQuery($insSQL);
exit;
}
}
In the code example "GetResultByNumber(num)as string()" is used. The execution of the above code is simple, first the function is called and the corresponding record is fetched from the database, if the record is available in the database then it will simply be fetched and displayed. On the other hand, if the record is not available in the database, then it will use the web service, fetch the record if available, save it in the database and finally display it.
Demo
Saturday, April 5, 2008
Monday, March 24, 2008
Reverse Number Lookup API
Call-x allows you to do reverse lookup for United States, Canada, and Pakistan at this time.
The Pakistan Lookup is only available for PTCL numbers.
The API below can be used as a web service.
The API is SOAP based, so you can use it in any language.
The service has two functions, GetResultByName and GetResultByNumber, and the return type of these functions is array of string type.
1) the function GetResultByName has the following declaration.
GetResultByName(firstname, lastname, city, state) as String()
this function has four parameters, firstname, lastname, city and state. Parameter “lastname” is an essential parameter that must be given. This function returns the address and the phone number of the owner of given details.
2) the function GetResultByNumber has the following declaration.
GetResultByName(num) as String()
this function has only one parameter “num”. This function returns the Name and the address of the owner of given number.
Example 1) GetResultByName(firstname,lastname,city,state) as string
First Name: Sultan [optional]
Last Name: Ahmed [mandatory]
City: [optional]
State: [optional]
the result will be the detail of the owner including the address and the phone number of the owner.
Example 2) GetResultByNumber(num) as string
Number: 7134672333
the result will be the detail of the owner including the address and the phone number of the owner.
The Pakistan Lookup is only available for PTCL numbers.
The API below can be used as a web service.
The API is SOAP based, so you can use it in any language.
The service has two functions, GetResultByName and GetResultByNumber, and the return type of these functions is array of string type.
1) the function GetResultByName has the following declaration.
GetResultByName(firstname, lastname, city, state) as String()
this function has four parameters, firstname, lastname, city and state. Parameter “lastname” is an essential parameter that must be given. This function returns the address and the phone number of the owner of given details.
2) the function GetResultByNumber has the following declaration.
GetResultByName(num) as String()
this function has only one parameter “num”. This function returns the Name and the address of the owner of given number.
Example 1) GetResultByName(firstname,lastname,city,state) as string
First Name: Sultan [optional]
Last Name: Ahmed [mandatory]
City: [optional]
State: [optional]
the result will be the detail of the owner including the address and the phone number of the owner.
Example 2) GetResultByNumber(num) as string
Number: 7134672333
the result will be the detail of the owner including the address and the phone number of the owner.
Subscribe to:
Posts (Atom)