Reputation: 186
I'm using the following in my php code:
$file="query.txt";
$f=fopen($file,'a');
fwrite($f,"Query String:".$_SERVER['QUERY_STRING']."\n");
fclose($f);
It never returns anything. I'm simply trying to record the queried url when someone visits (i.e. http://example.com/index.php?q=string. Other $_SERVER fields seem to work just fine, it only seems to be the query string that doesn't work. Maybe there's something I need to setup in my .htaccess?
I'm hoping someone has an answer to how to get this to information to show.
Upvotes: 0
Views: 154
Reputation: 186
This solved the problem:
$_SERVER['REDIRECT_QUERY_STRING']
solution from https://stackoverflow.com/a/11618256/1125006
Upvotes: 1