I am trying to record incoming keywords from google searches.

So far I have this code (Im new)

Code:
<?php
echo $_SERVER['HTTP_REFERER'];
?>

For example, this is where I would grab the keyword from -

http://search.yahoo.com/search?p=KEY...=UTF-8&fr=moz2

Can someone provide me with the code to do this?