Search Engine Script

This is a handy little script that takes all the complexity out of having a "search this site" function on any website. It utilizes the Google API on the backend, so you do not need a database backend. Since it uses Google, you are able to index anything that Google can index (PDF files, Word documents, Excel spreadsheets, etc.) In the end, you only need a single PHP script on your server (search.php).

Search Engine Script Setup Instructions

    Requirements
    PHP enabled web server that allows usage of fopen() (which is enabled by default).
  1. Edit the search.php file (you need to set your Google API key as well as the site you wish to search near the top of that file). If you don't have a Google API key, you can get one for free from here.
  2. Copy the search.php to your web server.
  3. Put the HTML below onto the web page(s) you wish to have a search function from. If some of the HTML pages are not in the same directory as your search.php, you should change <FORM METHOD="GET" ACTION="search.php"> to <FORM METHOD="GET" ACTION="http://www.yoursite.com/search.php">.
  4. Feel free to alter the search box HTML as well as the search.php file to work it into your site's look/feel. The only thing we ask is that you leave the link to us near the search box. That way if others want to use the service, they can. The links will occasionally be validated, and the search script may stop working if it is removed (this will allow us to keep it a 100% free service without any ads).
  5. Some additional ideas:
Search Your Site:

Add this to your site

The HTML for your website: