Parsing Domain From URL In PHP

Posted by zuk1 on Stack Overflow See other posts from Stack Overflow or by zuk1
Published on 2008-11-09T21:44:48Z Indexed on 2010/05/16 22:10 UTC
Read the original article Hit count: 160

Filed under:

I need to build a function which parses the domain from a url.

So:

http://google.com/dhasjkdas/sadsdds/sdda/sdads.html or http://www.google.com/dhasjkdas/sadsdds/sdda/sdads.html

Would become "google.com" and

http://google.co.uk/dhasjkdas/sadsdds/sdda/sdads.html

would become "google.co.uk"

© Stack Overflow or respective owner

Related posts about php