Get Original Referrer URL from Google Search with PHP?

Muhammad Shahzad picture Muhammad Shahzad · Apr 3, 2013 · Viewed 14.1k times · Source

I am using $_SERVER['HTTP_REFERER'];, to getting Referrer URL.

When I typed in Google search box the q='some text'

`https://www.google.com.pk/#hl=en&output=search&sclient=psy-ab&q=some text%2Ftestbulkresponse&oq=some text%2Ftestbulkresponse&gs_l=hp.3...15460.24280.1.25007.30.30.0.0.0.0.325.7136.2-27j3.30.0...0.0...1c.1.8.hp.dAvuch3bBg4&psj=1&bav=on.2,or.r_qf.&bvm=bv.44697112,d.ZWU&fp=980e418276b62e8c&biw=1366&bih=595`

but when I get this URL on my website using as $_SERVER['HTTP_REFERER'];

the q=null like this

`http://www.google.com.pk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CC0QFjAA&url=http%3A%2F%2Fwww.bulkresponse.com%2Ftestbulkresponse%2Fdashboard.php&ei=r9NbUfv7GcjaOYDdgKgC&usg=AFQjCNF9U_DpJEwupZ0ZLPbjWJ6DQLWZcA&bvm=bv.44697112,d.ZWU`. 

So I am unable to get searched keywords in Google, what should I can do to get searched keywords?

Answer

Maks3w picture Maks3w · Apr 3, 2013

Google removes the search query for HTTPS connections and logged users so the only way to know the search query is using Google Analytics

When you search from https://www.google.com, websites you visit from our organic search listings will still know that you came from Google, but won't receive information about each individual query.

http://googleblog.blogspot.com.es/2011/10/making-search-more-secure.html http://analytics.blogspot.com.es/2011/10/making-search-more-secure-accessing.html