title: Get keyword from a (search engine) referrer url using PHP
body: <p>I am trying to get the search keyword from a referrer url. Currently, I am using the following code for Google urls. But sometimes it is not working...</p>
  
  <pre><code>$query_get = "(q|p)";
  $referrer = "http://www.google.com/search?hl=en&amp;q=learn+php+2&amp;client=firefox";
  preg_match('/[?&amp;]'.$query_get.'=(.*?)[&amp;]/',$referrer,$search_keyword);
  </code></pre>
  
  <p>Is there another/clean/working way to do this?</p>
  
  <p>Thank you,
  Prasad</p>