How use Net_DNS because my code dont show me anything?

blakmetall207

New member
im starting in php like 2 months ago, and im stucked righ now. look the code:

<?php

require_once "Net/DNS.php";

function checkMailDomain($domain,$type)
{

// Create a DNS resolver and look up an $type record for $domain

$resolver = new Net_DNS_Resolver( );
$response = $resolver->search($domain,$type);

// Is there an answer record?
if ( isset($response->answer) )
{
// Iterate through the answers

foreach($response->answer as $ans)

// If it's a $type answer, return true

if ($ans->type == $type)
return true;
}

return false;
}

$mail= $_GET["email"];

$maildomain = substr( strstr($mail, '@' ), 1 );

if( checkMailDomain($maildomain,"MX") || checkMailDomain($maildomain,"A") )
{
print "The mail is valid";
}
else
{
print "the mail is invalid";
}

?>

this code is supossed to validate an email.

im in the chapter of validation with php. idk if is a book out of date if i need to change some lines pls tell me.

lots of points pls.

my pear installation its ok, the require once too.

idk if the problem is that i have a private ip. pls answer.
 
Back
Top