Forum Moderators: coopster

Message Too Old, No Replies

Getting the domain

getting a portion of a string to get the domain

         

kenchix1

4:48 pm on Dec 7, 2006 (gmt 0)

10+ Year Member



My objective is to get the domain of a url, something like aaa.widget.cim/aaa/aa and I want to get the domain widget.cim.

Im a newbie with PHP and honestly I don't have any idea because I can't rely on .com alone.

any suggestion please?

Thanks in advance.

studawsons

5:23 pm on Dec 7, 2006 (gmt 0)

10+ Year Member



Your post was a bit jumpled

try looking at the $_SERVER array

do this

print_r($_SERVER);

Also look at the following:

[uk.php.net...]

justageek

7:52 pm on Dec 7, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



To parse any URL use parse_url().

JAG

kenchix1

2:01 am on Dec 8, 2006 (gmt 0)

10+ Year Member



thanks! I'll check out the parse_url.