ASP network Programming: Using ASP to build a private search engine

Source: Internet
Author: User
Tags key string

Many online enthusiasts are racking their brains to make their Web sites more comprehensive when they create their own profile pages. In this paper, I introduce a method of using ASP to build your own search engine.

The basic idea is to use a form to store the user-submitted search keywords in a variable and submit it to ASP script processing. Using the ASP built-in "REQUEST" object to get the key characters in the variable, and then use "RESPONSE" "REDIRECT" function to turn the key characters into other professional search engines such as Sohu, NetEase, can produce search results. Make it easy for visitors to use major search engines on their homepage without having to sign in to their main page.

The first step is to create the main page of the search engine. Add the following code between the body> and the/body> in the HTML file:

Form Name= "Form1" method= "Post" action= "Search.asp"

Div align= "Center" Select your preferred search engine, br>< br>

Select Name= "Select" size= "1"

option> Sohu/option>

option> Sina (Beijing station),/option>

option> NetEase,/option>

/select>< br>< br>

Please type the keyword you want to query for br>

Input type= "text" Name= "TextField" >

br>< br>

Input type= "Submit" name= "submit" style= "color: #CC0033; Font-size:9pt;border: #CC0033 1px solid;height:18px" value= "search Cable ">

/form>

In this, we provide Sohu, Sina, NetEase 3 kinds of search engine for the user to choose, after the user type the key string, the form submits the request to the backstage search.asp processing.

The second step is to write the ASP program in the background. Add the following code between body> and/body> in the HTML file:

% if Request.Form ("select") = "Sohu" then Response.Redirect ("http://site.search.sohu.com/

Sitesearch.jsp?key_word= "&&request.form (" TextField ")) End If

If Request.Form ("select") = "Sina (Beijing Station)" then Response.Redirect ("http://site.search.sohu.com/

Sitesearch.jsp?key_word= "&&request.form (" TextField ")) End If

If Request.Form ("select") = "NetEase" then Response.Redirect ("http://search.163.com/cgi-bin/search/engine/search2.fcgi?") Lang=gb&&key= "&&request.form (" TextField ")) End If

%>

When implementing a commit search string to another search engine, it is critical to understand the query format used by these search engines. such as Sohu with is "http://site.search.sohu.com/sitesearch.jsp?key_word=" search string. We only need to pay attention to the use of these search engines, give the search results when the address in the address bar to record the analysis, remove the back of such as "%c1%f5% ..." character (this is our submitted search string converted into the character), you can get the query format.

In addition, many search engines use classification lookups. Can be subdivided into "website", "webpage", "News" and other categories, each kind of query format is not the same, the reader can use more if statements to establish a selection, to achieve the same search engine within the category of the classification.

In the same vein, we can expand the program to include other search engines to make it more powerful.

Shanghai treatment of Impotence Hospital Program I hope you will understand the problem of using ASP to build a private search engine.

ASP network Programming: Using ASP to build a private search engine

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.