Is there a simple way to get the current URL and store it to a varible?
You could try $REQUEST_URI or $_SERVER[REQUEST_URI] this will get the current file at least.
There are different server variables like $REQUEST_URI and others ($_REQUEST array). Check the manual for the best one for your purposes.