Search engine technology core revealing (PHP)

zhaozj2021-02-17  54

Editor's note: This is a wonderful programming article, not only analyzes the principles of search engines, but also provides some ideas for using PHP to prepare search engines. The whole article is deeply in-depth, I believe that no matter whether it is a master or a rookie, it can get a lot of inspiration.

When talking about web search engines, most people think of Yahoo. Indeed, Yahoo has created a search era of an internet network. However, Yahoo's technology currently used for searching web pages is not the company's original development. In August 2000, Yahoo used the technology of venture companies created by Google (www.google.com). Reasons are very simple, Google's search engine is more frequent and more accurately searching for the technology, more accurate search engine.

Let us design it yourself, develop a strong, efficient search engine and database, I am afraid in a short period of technology, funds, etc., but since Yahoo is using others, then we can use others. Search engine website?

Analysis of programming ideas

We can imagine: simulate a query, send a search command to a search engine website, then return to the search result, analyze the HTML code of the result, strip unnecessary characters and code, and finally display the format required In our own website page.

In this way, the key to the problem is that we have to select an accurate search information (so our search will be more meaningful), fast speed (because we analyze search results and display an additional time), search results are simple (easy Search website for HTML source code analysis and stripping), due to the various excellent features of the new generation of search engine Google, here we choose it as an example, let's see how to use PHP to implement the background to google (www.google.com) search, Personalization of front desk shows this process.

Let's take a look at the composition of Google's query commands. Enter the www.google.com website, enter "ABCD" in the query bar, click the query button, we can find that the browser's address bar becomes: "http://www.google.com/search?q=abd&btng=google % CB% D1% CB% F7 & HL = zh-cn & lr = ", it can be seen that Google is passed through the GET method of forms and submits the query command. We can use the file () function in the PHP to simulate this query process.

Learn about File () functions

Grammar: Array File (String FileName);

The return value is an array, read all of the files into the array variable. The file here can be local or remote, and remote files must indicate the protocol used. For example: result = file ("http://www.google.com/search?q=abd&btng=google

转载请注明原文地址:https://www.9cbs.com/read-29742.html

New Post(0)