Posted By

hasantayyar on 08/15/09


Tagged

php


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

hasantayyar
umang_nine
ignace
digitalbart
Envo


PHP Google Keyword Referrer


 / Published in: PHP
 

URL: http://www.liamdelahunty.com/tips/php_google_referer.php

  1. // take the referer
  2. $thereferer = strtolower($_SERVER['HTTP_REFERER']);
  3. // see if it comes from google
  4. if (strpos($thereferer,"google")) {
  5. // delete all before q=
  6. $a = substr($thereferer, strpos($thereferer,"q="));
  7. // delete q=
  8. $a = substr($a,2);
  9. // delete all FROM the next & onwards
  10. if (strpos($a,"&")) {
  11. $a = substr($a, 0,strpos($a,"&"));
  12. }
  13. // we have the results.
  14. $mygooglekeyword = urldecode($a);
  15. }

Report this snippet  

You need to login to post a comment.