Using VC components and ASP to realize real time search online

Source: Internet
Author: User
Someone recently asked how to use ASP to get another Web page, and analysis of the use of its data, pure ASP is not to do this, so I used VC to do an HTTP component, very simple, as asphttp, because the time problem I did not do post method, can only use Get method, But it is more than enough to deal with big search engines like Yahoo and Sina. Use this component to send requests to these stations, and then use the ASP analysis and get useful data, the analysis of the idea is to use the logo bit, if you want to do general-purpose, you can use the configuration file. I will not explain more, see examples. My component and source code download address is as follows:

Component: Http://homepage.qdcatv.com.cn/bigeagle/myhttp.zip
Source code: Http://homepage.qdcatv.com.cn/bigeagle/myhttpcode.zip

The following is an ASP example program, the search engine is using Yahoo

Test2.asp

<%@ Language=vbscript%>
<HTML>
<HEAD>
<meta name= "generator" content= "Microsoft Visual Studio 6.0" >
</HEAD>
<BODY>

<form action= "test1.asp" method= "Get" >
<input type=text name= "keyword" >
<input type=submit value= "Find" >
</form>

</BODY>
</HTML>


Test1.asp
<%
Dim m_objmyhttp, M_strhtml
Set m_objmyhttp = Server. CreateObject ("Myhttp.") OpenURL ")" Create object

' Accept page parameters
M_strkeyword = Server. UrlEncode (Trim (request.querystring ("keyword"))

' Request to Yahoo to send search keyword ' c + + '
M_objmyhttp.url = "http://search.yahoo.com/bin/search?p=" &m_strKeyword& ""

' Send request
M_objmyhttp.sendrequest ()

' Take HTML to a local variable
m_strhtml = m_objmyhttp.html
Set m_objmyhttp = Nothing


' Analysis, use of logo bits
Dim M_strbegintag, M_strendtag, m_strURL

' Set flag bit
M_strbegintag = "<table border=0 cellpadding=0 cellspacing=0><tr><td height=5></td></tr ></table><dd><li> "
M_strendtag = "</a>"

M_intbegin = 1
M_intend = 0
Do as not M_intbegin = 0
M_intbegin = InStr (M_intbegin + 1, m_strhtml, M_strbegintag)
M_intend = InStr (M_intbegin + len (m_strbegintag), m_strhtml, M_strendtag)
m_strURL = Mid (m_strhtml, M_intbegin+len (M_strbegintag), M_intend-m_intbegin-len (M_strbegintag) +4)
If M_intbegin <> 0 Then
Response.Write m_strURL + "<br>"
End If
Loop

%>



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.