[SOLVED] Using checkdnsrr() for MX record

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tristanlee85
Forum Contributor
Posts: 172
Joined: Fri Dec 19, 2003 7:28 am

[SOLVED] Using checkdnsrr() for MX record

Post by tristanlee85 »

I'm just starting something very basic to test a few things. Here is my code:

Code: Select all

<?php

// Get the posted vars
$domain = $_POST['domain'];
if (isset($domain) && $domain != NULL)
{
	if (checkdnsrr($domain,"MX"))
	{
		echo "The domain already exists";
		echo "<br />" . $domain;
	}
	else
	{
		echo "You can purchase this domain";
		echo "<br />" . $domain;
	}
}
?>

<html>
<head></head>
<body>
<form action="?" method="post">
<input type="text" name="domain" size="50">
<input type="submit" value="Check domain">
</form>
</body>
</html>
No matter what I try, it returns false and says "You can purchase this domain". Is there something I am doing wrong? All of the other examples I've seen do this.
Last edited by tristanlee85 on Sun Oct 15, 2006 2:42 am, edited 1 time in total.
tristanlee85
Forum Contributor
Posts: 172
Joined: Fri Dec 19, 2003 7:28 am

Post by tristanlee85 »

Fixed. I guess using the 'ANY' type did the trick.
Post Reply