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 www.google.com and path and the query.
below is the sample code
< ?php $url = "http://www.mistonline.in/index.php?php=4"; $parts = parse_url($url); print_r($parts); echo " scheme - $parts[scheme]"; echo " url - $parts[host]"; echo " path - $parts[path]"; echo " query - $parts[query]"; ?>
OutPut
scheme -> http
url -> www.mistonline.in
path -> /index.php
query -> php=4