Results 1 to 2 of 2

Thread: Regex to match search engines, keywords, browsers?

  1. #1
    Registered
    Join Date
    Mar 2004
    Location
    Philadelphia, PA
    Posts
    106

    Regex to match search engines, keywords, browsers?

    I'm writing a bit of a log analyzer and before I spend a ton of time doing this myself, was wondering if anyone had some info or knew of a script I could look at that already does what I need (so I can use the code as an example, I'm still writing something new).

    I have referring URLs to a website, and I'd like to be able to identify if that URL is of a major search engine. If so, I'd also like to be able to get the keywords used in the search.

    Getting the keywords should be pretty simple just by building myself a list of the parameter names used by each search engine for the keywords (such as q= for Google) and using PHP's functions for parsing query strings. I need to find which SE first.

    I also need to get the browser and operating system out of the user agent string, which I can either log from the client by JavaScript or try to access through $_SERVER['HTTP_USER_AGENT'].

    So again... what I'm asking is if anyone's already written similar code, or knows of a script I can take a look at that has some of these expressions already written, it'd save me a load of time. Thanks
    I'm Dan. This is my blog. I give you... free web stats.

  2. #2
    Registered
    Join Date
    Mar 2004
    Location
    Philadelphia, PA
    Posts
    106
    Thought I'd share what I've found since writing this:

    PHP has a handy get_browser() function that hands you all kinds of information when passed a useragent string.

    It uses a browscap.ini file for patterns to match different browsers and systems and the info about them. Very regularly updated copies are available here.

    That solves the browser/OS parsing problem.

    As for identifying search engines and keywords, I found a nice list somewhere (that I've lost already) of search engine URLs and the names of their query parameter, which I hand-wrote into an array to loop through and match against. I might end up rewriting that later to something more flexible.
    I'm Dan. This is my blog. I give you... free web stats.

Similar Threads

  1. pure flash search engines friendly
    By organ in forum Search Engine Optimization
    Replies: 3
    Last Post: 02-08-2006, 12:50 PM
  2. auto search and replace keywords with links
    By aegis in forum Website Programming & Databases
    Replies: 5
    Last Post: 06-29-2005, 12:26 PM
  3. SEO paying someone to do it.
    By jr1966 in forum Search Engine Optimization
    Replies: 21
    Last Post: 09-08-2004, 06:21 AM
  4. Search engines are killing my writing skills!
    By Westech in forum General Chat
    Replies: 4
    Last Post: 06-15-2004, 09:22 PM
  5. How much text is indexed by search engines?
    By flyingpylon in forum Search Engine Optimization
    Replies: 2
    Last Post: 12-22-2003, 09:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •