Build a phpinfo(); page, that will show you alot about your version of php. At the bottom of that page it will also show you some server variables and stuff. Look for something like:
_SERVER["REQUEST_URI"]
I think that will bring back the path and any variable send in the header. Double check that though. You can then access this variable in your code by adding a $, like this:
$url = $_SERVER["REQUEST_URI"];
to create the phpinfo page create a page that only contains this:
<? phpinfo(); ?>
and head to the bottom. It may help to hit the page with something in the header to test it. Something like this:
www.apples.com/info.php?test=yes
and you should see a server variable that says:
/info.php?test=yes
Make sence or am I running on, and on, and on? Need more help let me know.