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.

below is the sample code

< ?php
$url = "";
$parts = parse_url($url);
echo "
scheme - $parts&#91;scheme&#93;";
echo "
url - $parts&#91;host&#93;";
echo "
path - $parts&#91;path&#93;";
echo "
query - $parts&#91;query&#93;";


scheme -> http
url ->
path -> /index.php
query -> php=4

Leave a Reply

Your email address will not be published. Required fields are marked *