在PHP中获取搜索关键字的可靠性

My Goal is to get exact keywords provided to a search engine by which a user has arrived to my webpage. i found script to get these keywords from link.

$referringPage = parse_url( $_SERVER['HTTP_REFERER'] );
if ( stristr( $referringPage['host'], 'google.' ) )
{
    parse_str( $referringPage['query'], $queryVars );
    echo $queryVars['q']; // This is the search term used
}

and also found following script from link.

function search_engine_query_string($url = false) {

    if(!$url) {
        $url = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : false;
    }
    if($url == false) {
        return '';
    }

    $parts = parse_url($url);
    parse_str($parts['query'], $query);

    $search_engines = array(
        'bing' => 'q',
        'google' => 'q',
        'yahoo' => 'p'
    );

    preg_match('/(' . implode('|', array_keys($search_engines)) . ')\./', $parts['host'], $matches);

    return isset($matches[1]) && isset($query[$search_engines[$matches[1]]]) ? $query[$search_engines[$matches[1]]] : '';

}

My question is that what is the credibility of keywords got by these scripts, either these scripts give exact keywords from user provided to Search engine?