You are here: Re: Validate domain name context « PHP Programming Language « IT news, forums, messages
Re: Validate domain name context

Posted by Sagari on 01/28/07 02:43

Three objections:

1. Not all the registered domain names have valid 'A' record. In that
case, gethostbyname() won't return anything meaningful for registered
domain. You'll have to address WHOIS database directly and that isn't
an easy and quick trick, generally.

2. Domain names check might be required to register that domain.
Again, gethostbyname(0 won't return anything useful.

3. In case the corresponding nameservers are unreachable at the
moment, gethostbyname() won't return anything valid

I only wished to say that gethostbyname() doesn't fit all the cases
and, in general, it makes validation significantly slower.

Best wishes,

Konstantin

> This check will allow for a domain like 'foobar.quux.quuux.' even though
> it is obviously not a real domain though. To check that it's a real,
> registered domain name, which points to a real IP address, we can use
> gethostbyname():
>
> // Firstly, do all the above stuff to make sure it it syntactically
> // correct. No point wasting network resources calling gethostbyname()
> // for a domain that is obviously invalid. Now:
>
> $domain_ok = $domain_ok && !empty(gethostbyname($domain));
>
> // Now $domain_ok is TRUE iff $domain is an Internet host. Yay!
>
> --
> Toby A Inkster BSc (Hons) ARCS
> Contact Me ~http://tobyinkster.co.uk/contact

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация