I guess I was just happy that I was able to remember how to do PHP. Yeah, that one works better. Just seemed a bit similar. Besides, people usually give pseudo code any way rather than working code. My code didn't work. Yours was better. - Dan On 8/7/07, Jim Lucas <lists@xxxxxxxxx> wrote: > > Stut wrote: > > Jim Lucas wrote: > >> Dan wrote: > >>> What are you trying to do exactly, maybe there's a better way. If > >>> you're trying to determine if an email address is valid there's a > >>> pretty cool way to do so by using dns records. It's like 5 lines, > >>> here's the site > http://www.sitepoint.com/article/users-email-address-php > >>> > >>> As far as actually just getting the domain, w/o subdomains from a > >>> string you could try this. I'm not sure if the code runs because I > >>> haven't tested it, and I have been working exclusively with Delphi > >>> for a month so something might be off. > >>> > >>> function getDomain($email) > >>> { > >>> list($userName, $mailDomain) = split("@", $email); > >>> $anarray = split(".", $mailDomain); > >>> for ($i = 0; $i < count($anarray); $i++) > >>> { > >>> if (in_array($anarray[$i], $TLDArray)) // if $anarray[$i] is a TDL > >>> then we move back 1 to get it's domain > >>> return $anarray[$i-1] . '.' . $anarray[$i]; > >>> } > >>> } > >> > >> As far as I can tell, this doesn't work at all. > >> > >> Yours, > >> > >> http://www.cmsws.com/examples/php/domain_verification/example2.php > >> > >> Mine, > >> > >> http://www.cmsws.com/examples/php/domain_verification/example.php > > > > And yours is fatally flawed. Not all ccTLDs are sub-divided. > > Fixed. > > > > > http://dev.stut.net/php/domain.php > > > > http://stut.be/ > > > > -Stut > > > > > -- > Jim Lucas > > "Some men are born to greatness, some achieve greatness, > and some have greatness thrust upon them." > > Twelfth Night, Act II, Scene V > by William Shakespeare > > -- Confidentiality Statement: This message is intended only for the use of the Addressee and may contain information that is PRIVILEGED and CONFIDENTIAL. If you are not the intended recipient, dissemination of this communication is prohibited. If you have received this communication in error, please erase all copies of the message and its attachments and notify us immediately.