Pages

Friday, January 15, 2010

PHP5 Consume .Net Web service

error_reporting(E_ALL);
$ValidateEmail = new SoapClient("http://www.webservicex.net/ValidateEmail.asmx?wsdl");
$email = array("Email" => "me@somewhere.com");
try {
$response = $ValidateEmail->IsValidEmail($email);
if ($response->IsValidEmailResult) {
echo $email["Email"] . " is a valid email address";
} else {
echo $email["Email"] . " is not a valid email address";
}
} catch (SoapFault $fault) {
//LOG IF YOU WANT
echo $email["Email"] . " is not a valid email address";
}

echo '
' . var_dump($response) . '
';
?>

No comments:

Post a Comment