Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 228
  • Last Modified:

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 ?
0
MirageSF
Asked:
MirageSF
1 Solution
 
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now