<?php
 
 
/**
 
 * @author Eric Sizemore <[email protected]>
 
 * @package Search Keywords
 
 * @version 3.0.0
 
 * @copyright 2006 - 2024 Eric Sizemore
 
 * @license GNU GPL v3
 
 *
 
 * This program is free software: you can redistribute it and/or modify
 
 * it under the terms of the GNU General Public License as published by
 
 * the Free Software Foundation, either version 3 of the License, or
 
 * (at your option) any later version.
 
 *
 
 * This program is distributed in the hope that it will be useful,
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
 * GNU General Public License for more details.
 
 *
 
 * You should have received a copy of the GNU General Public License
 
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 */
 
 
/*
 
 * Honestly, there is not much to using this class. It is very simple and does
 
 * not take much to get going. You really only need to do the following:
 
 */
 
 
// First include the class file.
 
require_once('./Keywords.php');
 
 
// Next, instantiate the object using it's "getInstance()" function
 
$keys = \Esi\Search\Keywords::getInstance();
 
 
// Everything else is pretty much handled for you automatically.
 
// Calling 'getKeys()' will automatically parse the referrer for you.
 
$keys = $keys->getKeys();
 
 
/*
 
 * The 'getKeys()' call will return an array with the following structure:
 
 *
 
 * array(3) {
 
 * ['referer'] => 'referrer url',
 
 * ['keywords'] => 'keyword',
 
 * ['engine'] => 'search engine'
 
 * }
 
 *
 
 * For example:
 
 *
 
 * array(3) {
 
 * ['referer']=> string(160) "https://search.yahoo.com/search;_ylc=X3oDMTFiN25laTRvBF9TAzIwMjM1MzgwNzUEaXRjAzEEc2VjA3NyY2hfcWEEc2xrA3NyY2h3ZWI-?p=test&fr=yfp-t&fp=1&toggle=1&cop=mss&ei=UTF-8"
 
 * ['keywords']=> string(4) "test"
 
 * ['engine']=> string(5) "yahoo"
 
 * }
 
 */
 
if (count($keys)) {
 
    echo "Referring URL: $keys[referer]<br />Keywords: $keys[keywords]<br />Search Engine: $keys[engine]";
 
}
 
 
/*
 
 * The above will output something similar to:
 
 *
 
 * Referring URL: https://search.yahoo.com/search;_ylc=X3oDMTFiN25laTRvBF9TAzIwMjM1MzgwNzUEaXRjAzEEc2VjA3NyY2hfcWEEc2xrA3NyY2h3ZWI-?p=test&fr=yfp-t&fp=1&toggle=1&cop=mss&ei=UTF-8
 
 * Keywords: test
 
 * Search Engine: Yahoo
 
 */
 
 
// And honestly, that's really all there is to it.
 
 |