Location: PHPKode > scripts > Detect Credit Card Fraud using PHP SOAP Web Service for Internet Merchants > detect-credit-card-fraud-using-php-soap-web-service-for-internet-merchants/FraudLabsWebServiceClientPHP.php
<!--
//////////////////////////////////////////////////////////////////////////////////
//
//  This source code is only licensed to our premium subscribers. It is provided "as is" and without warranties.
//
//  http://www.fraudlabs.com © All Rights Reserved 2008
///
/////////////////////////////////////////////////////////////////////////////////
-->
<html>
	<head>
		<title>FraudLabs Credit Card Fraud Detection Web Service Sample Codes for PHP w/ nuSoap</title>
	</head>
	<form name="frmFraudLabs" id="frmFraudLabs" action="FraudLabsWebServiceClientPHP.php" method="post">
<br>

IP Address: <input type="text" name="ip" value="68.142.197.65" /> <br>
License Key: <input type="text" name="license" value="<Enter License Key>" /> <br>
City: <input type="text" name="city" value="SAN MATEO" /> <br>
Region: <input type="text" name="region" value="CALIFORNIA" /> <br>
Postal: <input type="text" name="postal" value="00501" /> <br>
Country: <input type="text" name="country" value="US" /> <br>
Email Domain: <input type="text" name="emaildomain" value="hide@address.com" /> <br>
Phone: <input type="text" name="phone" value="6041111111" /> <br>
BIN: <input type="text" name="bin" value="541726" /> <br>
BIN Name: <input type="text" name="binname" value="SOUTHERN BANK BERHAD" /> <br>
BIN Phone: <input type="text" name="binphone" value="60362047878" /> <br>
Shipping Address: <input type="text" name="shipadd" value="BLOCK D2 515-c, LORONG TUNA," /> <br>
Shipping City: <input type="text" name="shipcity" value="PRAI" /> <br>
Shipping Region: <input type="text" name="shipregion" value="PENANG" /> <br>
Shipping Postal: <input type="text" name="shippostal" value="13700" /> <br>
Shipping Country: <input type="text" name="shipcountry" value="MALAYSIA" /> <br>
Query ID: <input type="text" name="queryid" value="0000" /> <br><br>
<input type="submit" name="submit" />
</form>
<body>
<?php
	if (!isset($_POST['submit'])) {} // if page is not submitted to itself echo the form
	else
	{
	$ip = $_POST["ip"];
	$license = $_POST["license"]; 
	$city = $_POST["city"];
	$region = $_POST["region"];
	$postal = $_POST["postal"];
	$country = $_POST["country"];
	$emaildomain = $_POST["emaildomain"];
	$phone = $_POST["phone"];
	$bin = $_POST["bin"];
	$binname = $_POST["binname"];
	$binphone = $_POST["binphone"];
	$shipadd = $_POST["shipadd"];
	$shipcity = $_POST["shipcity"];
	$shipregion = $_POST["shipregion"];
	$shippostal = $_POST["shippostal"];
	$shipcountry = $_POST["shipcountry"];
	$queryid = $_POST["queryid"];
	
	if ($license == "<Enter License Key>" || $license == "")
	{
		echo "license key are required field." ;
	}
		
	else	
	{
	require_once('./lib/nusoap.php');

	// Call the service with this message
	$msg = '<FraudLabs xmlns="http://ws.fraudlabs.com/">
	<IP>'.$ip.'</IP>
	<CITY>'.$city.'</CITY>
	<REGION>'.$region.'</REGION>
	<POSTAL>'.$postal.'</POSTAL>
	<COUNTRY>'.$country.'</COUNTRY>
	<DOMAIN>'.$emaildomain.'</DOMAIN>
	<PHONE>'.$phone.'</PHONE>
	<BIN>'.$bin.'</BIN>
	<BINNAME>'.$binname.'</BINNAME>
	<BINPHONE>'.$binphone.'</BINPHONE>
	<LICENSE>'.$license.'</LICENSE>
	<SHIPADDR>'.$shipadd.'</SHIPADDR>
	<SHIPCITY>'.$shipcity.'</SHIPCITY>
	<SHIPREGION>'.$shipregion.'</SHIPREGION>
	<SHIPPOSTAL>'.$shippostal.'</SHIPPOSTAL>
	<SHIPCOUNTRY>'.$shipcountry.'</SHIPCOUNTRY>
	<QUERYID>'.$queryid.'</QUERYID>
	</FraudLabs>';
	
	// Create a new SOAP object
	$soapclient  = new soapclient_nusoap('http://ws.fraudlabs.com/fraudlabswebservice.asmx?wsdl','wsdl');
	if (!$soapclient->fault) { 

		$result = $soapclient->call('FraudLabs', array($msg));
		if(!isset($result['Error'])) {
			// No Error. Retrieve results.
			echo "COUNTRYMATCH = " . $result["COUNTRYMATCH"] . "<br>";
			echo "COUNTRY = " . $result["COUNTRY"] . "<br>";
			echo "HIGHRISKCOUNTRY = " . $result["HIGHRISKCOUNTRY"] . "<br>";
			echo "DISTANCE = " . $result["DISTANCE"] . "<br>";
			echo "IP2COUNTRY = " . $result["IP2COUNTRY"] . "<br>";
			echo "IP2REGION = " . $result["IP2REGION"] . "<br>";
			echo "IP2CITY = " . $result["IP2CITY"] . "<br>";
			echo "IP2LATITUDE = " . $result["IP2LATITUDE"] . "<br>";
			echo "IP2LONGITUDE = " . $result["IP2LONGITUDE"] . "<br>";
			echo "IP2ISP = " . $result["IP2ISP"] . "<br>";
			echo "ANONYMOUSPROXY = " . $result["ANONYMOUSPROXY"] . "<br>";
			echo "FREEMAIL = " . $result["FREEMAIL"] . "<br>";
			echo "BINCOUNTRYMATCH = " . $result["BINCOUNTRYMATCH"] . "<br>";
			echo "BINNAMEMATCH = " . $result["BINNAMEMATCH"] . "<br>";
			echo "BINPHONEMATCH = " . $result["BINPHONEMATCH"] . "<br>";
			echo "BINCOUNTRY = " . $result["BINCOUNTRY"] . "<br>";
			echo "BINBANKNAME = " . $result["BINBANKNAME"] . "<br>";
			echo "BINBANKPHONE = " . $result["BINBANKPHONE"] . "<br>";
			echo "POSTALCITYMATCH = " . $result["POSTALCITYMATCH"] . "<br>";
			echo "PHONECITYMATCH = " . $result["PHONECITYMATCH"] . "<br>";
			echo "SHIPFORWARD = " . $result["SHIPFORWARD"] . "<br>";
			echo "CREDITSAVAILABLE = " . $result["CREDITSAVAILABLE"] . "<br>";
			echo "FRAUDSCORE = " . $result["FRAUDSCORE"] . "<br>";
			echo "QUERYID = " . $result["QUERYID"] . "<br>";
			echo "MESSAGE = " . $result["MESSAGE"] . "<br>";			
		} else {
		  // Error
			echo "Error Description = " . $result["Error"]["Desc"] . "<br>";
			echo "Error Number = " . $result["Error"]["Number"] . "<br>";
		}
	} else {
		echo "Error = {$soapclient->faultcode}<br>";
		echo "String = {$soapclient->faultstring}";
	} // end if $soapclient->call is success
}
}
?>
Return current item: Detect Credit Card Fraud using PHP SOAP Web Service for Internet Merchants