Hi shadowlight, you certainly can access this information. The URL of the user's previous page is contained in the $_SERVER['HTTP_REFERER'] predefined variable [php.net].
You then need to extract the keyword from the search engine's URL, e.g. for Google:
You can use various methods to grab this info - one would be to split the string based on the question mark and & symbols (if they exist) or you could use a regular expression.