Now I have it like so:
<?
$url=$_SERVER['REQUEST_URI'];
$requred_string= substr(strrchr($url, "/"), 1);
?>
and it returns the last segment, but it also returns all the ?p=y&g=x gibberish that I don't need. How can I slice off the $_GET variables?
print_r(parse_url($url));