urlparse - How do you strip out the domain name from a URL in php? - Stack Overflow

PHOTO EMBED

Wed Jul 20 2022 12:50:06 GMT+0000 (UTC)

Saved by @kalehm

parse_url turns a URL into an associative array:

php > $foo = "http://www.example.com/foo/bar?hat=bowler&accessory=cane";
php > $blah = parse_url($foo);
php > print_r($blah);
Array
(
    [scheme] => http
    [host] => www.example.com
    [path] => /foo/bar
    [query] => hat=bowler&accessory=cane
)
content_copyCOPY

https://stackoverflow.com/questions/176284/how-do-you-strip-out-the-domain-name-from-a-url-in-php