How to get full referrer url in php

halilenver picture halilenver · Feb 1, 2013 · Viewed 24.1k times · Source

I want to get full referrer url in PHP. For instance, if I come to mywebsite from a google search, $_SERVER['REFERER'] gives me only www.google.com, but I want smth like www.google.com/search?q=KEYWORD

Google Analytics provides that for many search engines. I need to get "/search?q=KEYWORD" query string.

Answer

thaJeztah picture thaJeztah · Feb 1, 2013

Put this in your script and have a look at it's content;

<pre>
<?php
var_dump($_SERVER);
?>
</pre>

This way you can find out which keys contain 'what'