Request string without GET arguments
In PHP, you can use the $_SERVER['REQUEST_URI']
variable to get the request string without GET arguments. For example, if the full URL being accessed is http://example.com/page.php?id=5
, you can use $_SERVER['REQUEST_URI']
to get /page.php
.
You can also use parse_url function.
$url = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
This will give you the path of the URL requested by the client.