public static function getSearchWord($url)
    {
        $parsed_url = parse_url($url);
        if (!isset($parsed_url['host'])) {
            $parsed_url['host'] = '';
        }

        // Have domain
        $domain_parts = array_reverse(explode('.', $parsed_url['host']));
        if (!isset($domain_parts[1])) {
            return false;
        }

        // Known search engine
        $engine = $domain_parts[1];
        if (!isset(self::$se[$engine])) {
            return false;
        }

        // Have search query
        $search_params = self::$se[$engine];
        if (!isset($parsed_url['query'])) {
            return false;
        }

        // Get query
        parse_str($parsed_url['query'], $params);
        if (!$params) {
            return false;
        }

        // Check engine's matches
        if (is_string($search_params)) {
            // If string key
            return isset($params[self::$se[$engine]]) ? $params[self::$se[$engine]] : false;
        }

        // If multiple keys possible
        foreach ($search_params as $v) {
            if (!isset($params[$v])) continue;
            return $params[$v];
        }

        return false;
    }
public static function getSearchWord($url)
    {
        $parsed_url = parse_url($url);
        if (!isset($parsed_url['host'])) {
            $parsed_url['host'] = '';
        }

        // Have domain
        $domain_parts = array_reverse(explode('.', $parsed_url['host']));
        if (!isset($domain_parts[1])) {
            return false;
        }

        // Known search engine
        $engine = $domain_parts[1];
        if (!isset(self::$se[$engine])) {
            return false;
        }

        // Have search query
        $search_params = self::$se[$engine];
        if (!isset($parsed_url['query'])) {
            return false;
        }

        // Get query
        parse_str($parsed_url['query'], $params);
        if (!$params) {
            return false;
        }

        // Check engine's matches
        if (is_string($search_params)) {
            // If string key
            return isset($params[self::$se[$engine]]) ? $params[self::$se[$engine]] : false;
        }

        // If multiple keys possible
        foreach ($search_params as $v) {
            if (!isset($params[$v])) continue;
            return $params[$v];
        }

        return false;
    }
public static function getSearchWord ( $ url ) { $ parsed_url = parse_url ( $ url ) ; if ( ! isset ( $ parsed_url [ 'host' ] ) ) { $ parsed_url [ 'host' ] = '' ; } // Have domain $ domain_parts = array_reverse ( explode ( '.' , $ parsed_url [ 'host' ] ) ) ; if ( ! isset ( $ domain_parts [ 1 ] ) ) { return false ; } // Known search engine $ engine = $ domain_parts [ 1 ] ; if ( ! isset ( self :: $ se [ $ engine ] ) ) { return false ; } // Have search query $ search_params = self :: $ se [ $ engine ] ; if ( ! isset ( $ parsed_url [ 'query' ] ) ) { return false ; } // Get query parse_str ( $ parsed_url [ 'query' ] , $ params ) ; if ( ! $ params ) { return false ; } // Check engine's matches if ( is_string ( $ search_params ) ) { // If string key return isset ( $ params [ self :: $ se [ $ engine ] ] ) ? $ params [ self :: $ se [ $ engine ] ] : false ; } // If multiple keys possible foreach ( $ search_params as $ v ) { if ( ! isset ( $ params [ $ v ] ) ) continue ; return $ params [ $ v ] ; } return false ; }
Get search engine name by query string. required for SEO leads
@example $url = http://www.subsub.subdomain.google.lv/search?sourceid=chrome&ie=UTF-8&q=dfgdfgb+bgfhgfn+gfgfh+g
@param string $url
@return bool
Get search engine name by query string . required for SEO leads