View Full Version : finding the GETS from previous error

04-23-2012, 05:16 PM
I have a custom erro404.php file that shows when someone vists an incorrect page or something goes wrong they get redirected to this page.

I have the ErrorDocument 404 entery in htaccess

What I am after is to know what the URL was when the error happened.

If someone visits say www.site.com/thisPageDoesNotExisit.php?a=1&b=2&c=3
they would get taken to my error page.

When the error404 page loads is there a way to grab the $_GETS that were in the URL before ?

04-23-2012, 05:22 PM
try this;


04-23-2012, 07:36 PM
try this;


I tried this and got..

Notice: Undefined index: PATH_INFO

04-23-2012, 07:43 PM
looks like you have your error report set pretty high, try adding this to the top of your script or in your settings file.

error_reporting(E_ALL & ~E_NOTICE);

04-23-2012, 10:28 PM
I'd actually use:

Alternatively you can just save the entire $_GET array instead (which can be far more useful) and then store it in the database.

To do this, you turn it into a string by using serialize($_GET). Should you need to then use this data in another script you can unserialize($Data) to turn it back into it's original array.

You can also do this with the $_POST array, $_REQUEST and with some work to save / move the files first and updating the values, $_FILES.

04-23-2012, 11:46 PM
strange i added the extra code to the error reporting as requested and the request_url is empty.