dslreports logo
site
 
    All Forums Hot Topics Gallery
spc

spacer




how-to block ads


Search Topic:
uniqs
6
share rss forum feed


Jafo232
You Can't Spell Democrat Without Rat.
Premium
join:2002-10-17
Boonville, NY

1 edit
reply to Jafo232

Re: PHP: Get TLD from URL

Actually your code is right, what I asked for is wrong. I need the domain name with the TLD, example:

http://www.dslreports.com/some/path/to/a/file.ext?name=value
 

To return just:

dslreports.com

Same with any URL:

http://somesubdomain.domain.com/path/to/somewhere
 

--
Custom PHP/Perl Development. Vbulletin And Wordpress Mods Too!


JAAulde
Web Developer
Premium,MVM
join:2001-05-09
Williamsport, MD
kudos:3

1 edit

1 recommendation

Ahh, I see. Very well then:

»codepad.org/UXGS161q

If both TLD and "top level host" are found, you should get them back. Otherwise you get an empty string.


Jafo232
You Can't Spell Democrat Without Rat.
Premium
join:2002-10-17
Boonville, NY
Thanks JAAulde! I will try this out. Hopefully it will work better than some of the other code I have tinkered with.
--
Custom PHP/Perl Development. Vbulletin And Wordpress Mods Too!


Jafo232
You Can't Spell Democrat Without Rat.
Premium
join:2002-10-17
Boonville, NY
reply to JAAulde
JAAulde, shot your a private message..