Re: [PHP] get domain component from email

2007-08-08 Thread Stut

Daniel Brown wrote:

On 8/7/07, Richard Lynch [EMAIL PROTECTED] wrote:

On Tue, August 7, 2007 1:25 pm, Kevin Waterson wrote:

Im looking for a way to get the domain from an email address.
Not sub domains, just the domain, so
[EMAIL PROTECTED]
would return
example.com.mn

similarly, the address [EMAIL PROTECTED] would return
example.com

perhaps an array of tld's, then strip the tld off the end and anything
before that and the next . is the domain?

also, somebody told me .co.uk was a tld, but I cannot see it listed
http://www.iana.org/root-whois/index.html

I think you're in trouble...

The rules for what is or isn't a TLD have changed over time.

I did see a nice article the other day in the RFCs about some
pragmatic ways to do this right without killing yourself, or coding
something that's bound to break within a very short time.  Don't know
the RFC# offhand though, but I got the feeling that it was pretty
recent...

The LAST thing you want to do is hard-code the list of known TLDs from
today, because that will change too often.

.co.uk is a TLD, afaik...



My understanding was that .co.uk and like domains were still SLDs,
but where a TLD wasn't available for registration under the ccTLD
format for the respective country.


This is just terminology, but to make it clear... .co.uk is a ccTLD not 
an SLD and .uk is *not* a TLD. The IANA website has lots of info on this 
stuff.


-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] get domain component from email

2007-08-07 Thread Jim Lucas

Kevin Waterson wrote:

Hi all.

Im looking for a way to get the domain from an email address.
Not sub domains, just the domain, so 
[EMAIL PROTECTED] 
would return 
example.com.mn


similarly, the address [EMAIL PROTECTED] would return
example.com

perhaps an array of tld's, then strip the tld off the end and anything
before that and the next . is the domain?

also, somebody told me .co.uk was a tld, but I cannot see it listed
http://www.iana.org/root-whois/index.html

Kind regards
Kevin



Give this a try

http://www.cmsws.com/examples/php/domain_verification/example.php

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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] get domain component from email

2007-08-07 Thread Dan
Yup, that's pretty much what I wrote but with a bit more feedback for 
invalid addresses.


- Dan

Jim Lucas [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

Kevin Waterson wrote:

Hi all.

Im looking for a way to get the domain from an email address.
Not sub domains, just the domain, so [EMAIL PROTECTED] would 
return example.com.mn


similarly, the address [EMAIL PROTECTED] would return
example.com

perhaps an array of tld's, then strip the tld off the end and anything
before that and the next . is the domain?

also, somebody told me .co.uk was a tld, but I cannot see it listed
http://www.iana.org/root-whois/index.html

Kind regards
Kevin



Give this a try

http://www.cmsws.com/examples/php/domain_verification/example.php

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


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] get domain component from email

2007-08-07 Thread Jim Lucas

Dan wrote:
Yup, that's pretty much what I wrote but with a bit more feedback for 
invalid addresses.


not exactly



- Dan

Jim Lucas [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

Kevin Waterson wrote:

Hi all.

Im looking for a way to get the domain from an email address.
Not sub domains, just the domain, so [EMAIL PROTECTED] 
would return example.com.mn


similarly, the address [EMAIL PROTECTED] would return
example.com

perhaps an array of tld's, then strip the tld off the end and anything
before that and the next . is the domain?

also, somebody told me .co.uk was a tld, but I cannot see it listed
http://www.iana.org/root-whois/index.html

Kind regards
Kevin



Give this a try

http://www.cmsws.com/examples/php/domain_verification/example.php

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




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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] get domain component from email

2007-08-07 Thread Richard Lynch
On Tue, August 7, 2007 1:25 pm, Kevin Waterson wrote:
 Im looking for a way to get the domain from an email address.
 Not sub domains, just the domain, so
 [EMAIL PROTECTED]
 would return
 example.com.mn

 similarly, the address [EMAIL PROTECTED] would return
 example.com

 perhaps an array of tld's, then strip the tld off the end and anything
 before that and the next . is the domain?

 also, somebody told me .co.uk was a tld, but I cannot see it listed
 http://www.iana.org/root-whois/index.html

I think you're in trouble...

The rules for what is or isn't a TLD have changed over time.

I did see a nice article the other day in the RFCs about some
pragmatic ways to do this right without killing yourself, or coding
something that's bound to break within a very short time.  Don't know
the RFC# offhand though, but I got the feeling that it was pretty
recent...

The LAST thing you want to do is hard-code the list of known TLDs from
today, because that will change too often.

.co.uk is a TLD, afaik...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] get domain component from email

2007-08-07 Thread Daniel Brown
On 8/7/07, Richard Lynch [EMAIL PROTECTED] wrote:
 On Tue, August 7, 2007 1:25 pm, Kevin Waterson wrote:
  Im looking for a way to get the domain from an email address.
  Not sub domains, just the domain, so
  [EMAIL PROTECTED]
  would return
  example.com.mn
 
  similarly, the address [EMAIL PROTECTED] would return
  example.com
 
  perhaps an array of tld's, then strip the tld off the end and anything
  before that and the next . is the domain?
 
  also, somebody told me .co.uk was a tld, but I cannot see it listed
  http://www.iana.org/root-whois/index.html

 I think you're in trouble...

 The rules for what is or isn't a TLD have changed over time.

 I did see a nice article the other day in the RFCs about some
 pragmatic ways to do this right without killing yourself, or coding
 something that's bound to break within a very short time.  Don't know
 the RFC# offhand though, but I got the feeling that it was pretty
 recent...

 The LAST thing you want to do is hard-code the list of known TLDs from
 today, because that will change too often.

 .co.uk is a TLD, afaik...

 --
 Some people have a gift link here.
 Know what I want?
 I want you to buy a CD from some indie artist.
 http://cdbaby.com/browse/from/lynch
 Yeah, I get a buck. So?

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



My understanding was that .co.uk and like domains were still SLDs,
but where a TLD wasn't available for registration under the ccTLD
format for the respective country.

-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

Hey, PHP-General list to give something back to everyone, you guys
can have 50% off every month on hosting plans of $10/mo. or more (list
price) at http://www.pilotpig.net/.
Use the coupon code phpgeneralaug07

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php