PHP Network
1- Is domain name taken 2- Get IP address 3- Port scan |
4- URL validation by Regular Expression
if (isset($_POST[‘posted’])) {
$url = $_POST[‘url’];
$theresults = ereg(“^[a-zA-Z0-9]+://[^ ]+$”, $url, $trashed);
if ($theresults) { $isamatch = “Valid”;
} else { $isamatch = “Invalid”; }
echo “URL validation says $url is ” . $isamatch;
}
5- DNS and host validation
$hostname = “www.yahoo.com”;
if (!isset($hostname)) {
die(“Hostname value wasn’t properly submitted. Retry.”);
}
if(empty($hostname)){
die(“Hostname field was left blank! Retry.”);
}
echo $hostname;
if(checkdnsrr($hostname)) {
echo “has a valid MX record!”;
} else { die(“does not exist”); }
Leave a Reply