I am trying to split the following dynamic url into several components like below. Url can be anything in the below format.
input:
https://www.test.com/directory/subdirectory/index.php?qry=4
or
https://www.test.com/directory/subdirectory/index.php
or
https://www.test.com/directory/index.php?qry=4
or
https://www.test.com/directory/index.php
or
https://www.test.com/index.php?qry=4
or
https://www.test.com/index.php
or
https://www.test.com/
output:
$http_part = "https";
$root_url = "www.test.com";
$subdirectory = "directory/subdirectory"; // if not available blank should be returned
$pagename = "index.php"; // if no page name is available default index.php
$paramerts = "qry=4"; // if not available blank should be returned
I know i can use url parsing, but it doesnt in all the situation.
Any function is available by inputting the url which will return all these outputs ?