Save below code as " dnlenght.php " and place it where you can run PHP scripts.
PHP Code:
<html>
<head>
<title>DN Lenght</title>
</head>
<body>
<div style="text-align:center; padding: 20px;">
<p>Enter domain list</p>
<form method="POST" action="dnlenght.php">
<textarea name="dnlist" rows="10" cols="60"><?php if(isset($_POST['dnlist'])) echo $_POST['dnlist']; ?></textarea><br />
<input type="submit" value="Submit">
</form>
<br>
<?php
if(isset($_POST['dnlist'])) {
echo "<b>Result</b><br>";
echo "<textarea rows=\"10\" cols=\"60\">";
$dnList = explode("\n", $_POST['dnlist']);
while (list($key, $val) = each($dnList)) {
if(!empty($val)) {
$domain = trim($val);
$domainLenght = explode('.',$domain);
$domainLenght = strlen($domainLenght['0']);
echo $domain . " ". $domainLenght . "\n";
}
}
echo "</textarea>";
}
?>
</div>
</body>
</html>
Bookmarks