Checking if a domain exists or not ?

If I create a form thats asks for a domain to be entered, i.e. MSN.COM how can I pass this to a whois database and get a value back if it exists, then how do I read this value so I can goto a different weburl depending on the results ?
MirageSFAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mattjp88Commented:
i think that the only way would be to check and see if there is an "http://" and a ".com" or ".org" ect.  if you think that thins will work then i will write a script for ya

Matt :-)
0
JonzaCommented:
Is it possible to use PHP?
I would have a great function for you that checks if the given URL exists.
0
JonzaCommented:
function urlExists($url)
{
$url = ereg_replace("http://", "", $url);
list($domain, $file) = explode("/", $url, 2);
$fid=fsockopen($domain,80);
fputs($fid,"GET /$file HTTP/1.0\r\nHost: $domain\r\n\r\n");
$gets = fgets($fid, 1024);
fclose($fid);
if (ereg("HTTP/1.1 200 OK", $gets)) return TRUE;
else return FALSE;
}

0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

MirageSFAuthor Commented:
That looks cool, but how do I call that from a html page ?  sorry for being a total noob :)
0
JonzaCommented:
here is a code for you:
-------------- form.php --------------------
<?php
function urlExists($url)
{
$url = ereg_replace("http://", "", $url);
list($domain, $file) = explode("/", $url, 2);
$fid=fsockopen($domain,80);
fputs($fid,"GET /$file HTTP/1.0\r\nHost: $domain\r\n\r\n");
$gets = fgets($fid, 1024);
fclose($fid);
if (ereg("HTTP/1.1 200 OK", $gets)) return TRUE;
else return FALSE;
}


if(isset($url) && !empty($url)){
   $check = urlExists($url);
   if($check){
      print("YEAH, the URL exists: <a href='$url'>$url</a>");
   }
   else{
      print("No, the url doesn't exist!");
   }
}//if
?>
<form action='form.php' method='post'>
<input type='text' name='url' value='http://experts-exchange.com'>
<br><input type='submit' value='check url'>
</form>
-------------- end of form.php -----------------

works 100% fine =)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rbagdonasCommented:
If using ASP:

I have a small COM+ object that checks for domain name availablity and presents you with a true/false whether it is available.  That way you do not have to send them to a different page can do this behind the scenes in your ASP code.

If you want more info, email me at info@siliconhillsgroup.com

R
0
COBOLdinosaurCommented:
This question has been classified abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.

<note>
Unless it is clear to me that the question has been answered I will recommend delete.  It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
</note>

If the user does not know how to close the question, the options are here:
http://www.experts-exchange.com/help/closing.jsp


Cd&

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.