Saturday, May 15, 2010

How to Extract Domain name from URL ?

Here is a simple example describe below.

“parse_url” function can be used to parse the URL.

parse_url is a built in php function which can be used to parse url and get the type of request like whether its http or https or ftp, gives the domain name like and path and the query.

eg. consider this url – “”

In “” this url if you execute parse_url function then it will show the following result.

Scheme - http
url -
path - /page.php
query - id=1

No comments:

Post a Comment

I just got my #domain @BigRock. Get upto 25% off with my personalized coupon link Get upto 25% off