title: How to get the referer search query from google?
body: <p>As recently as two days ago, the following code worked to get the search query from google:</p>
  
  <pre><code>$refer = parse_url($_SERVER['HTTP_REFERER']);
  $host = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST);
  $query = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY);
  
  if(strstr($host,'www.google.com'))
  {
      //do google stuff
      $qstart = strpos($query, 'q=') +2;
      $qend = strpos($query, '&amp;', $qstart);
      $qlength = $qend - $qstart;
      $querystring = substr($query, $qstart, $qlength);
      $querystring = str_replace('q=','',$querystring);
      $keywords = explode('%20',$querystring);
      $keywords = implode(' ', $keywords);
      return $keywords;                      
      }
  </code></pre>
  
  <p>However, now it does not.  I tested it by using echo($query) and it appears that the way google processes referrer query requests has changed.  Previously $query included </p>
  
  <p><code>"q=term1%20term2%20term3%20...</code></p>
  
  <p>Now, however, I am getting the following output when $query is echo'ed:</p>
  
  <pre><code>sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=2&amp;ved=0CCsQFjAB&amp;url=http%3A%2F%2Fexample.com%2F&amp;ei=vDA-UNnxHuOjyAHlloGYCA&amp;usg=AFQjCNEvzNXHULR0OvoPMPSWxIlB9-fmpg&amp;sig2=iPinsBaCFuhCLGFf0JHAsQ
  </code></pre>
  
  <p>Is there a way to get around this?</p>