$uri = $_SERVER['REQUEST_URI']; echo "The URI of this page is: $uri";
$uri = $_SERVER['REQUEST_URI']; $parts = parse_url($uri); echo "The protocol of the URI is: " . $parts['scheme'] . "
"; echo "The hostname of the URI is: " . $parts['host'] . "
"; echo "The path of the URI is: " . $parts['path'] . "
";
$uri = $_SERVER['REQUEST_URI']; $parts = parse_url($uri); parse_str($parts['query'], $params); echo "The value of the 'name' parameter is: " . $params['name'];In this example, we use the parse_str function to parse the query string of the URI into an array of key-value pairs, which we can then use to access individual query parameters. The package library for working with URIs in PHP is the PHP URI Template library (php-uritemplate). This library provides a set of functions for working with URIs, including parsing and template matching, and is available on Packagist.