Search Referrer Script

I did a major rewrite of the search word referrer script I got from scriptygodness.

What this does is read a file that contains URLs, assumably referring URLs, and generates the HTML. I am currently using the lgf script above to generate the file. I’ll be working on one of my own soon.

The original script called a method that gave back the referrer keywords. It used a big array hard coded into the script to do the matching. I hate hardcoded data, so I wanted to get this stuff in to a file. Also it had data that gave you the name of the search engine which I thought was cool and that I’d like to display, but the script didn’t return this information.

So I rewrote the whole thing. I moved the data into its own file and read it in to create the array. Then I use pretty much the same code to figure out the keywords, but return the search engine name along with the keywords.

Here is the script if you want to look at it or use it. Here is a link to the search engine text file.

One thing to notice is I rearranged the search engine list in the file so Google and Yahoo are at the top. I did this because they are the ones I get the most hits from and the search of the array will be done sooner.