Running the Search-Ranking Webbot

Example 11-1 shows the output of our search-ranking webbot. In each case, there must be both a test web page (the page we’re looking for in the search results) and a search term. In our test case, the webbot is looking for the ranking of http://www.loremianam.com, with a search term of webbots.[36] Once the webbot is run, it only takes a few seconds to determine the search ranking for this combination of web page and search term.

Example 11-1. Running the search-ranking webbot

C:\>php script_11_1.php
Searching for "www.loremianam.com" with the search term "webbots"
Searching for ranking on page #1
Searching for ranking on page #2

When performing a search on the term "webbots",
www.loremianam.com is ranked as item 10 on page 2
Its ranking is 2.10.


[36] Unlike a real search service, the demonstration search pages on the book’s website return the same page set regardless of the search term used.