Big Gray Wolf ASP toolbox-XMLHTTP application, get remote files, get remote HTML file source code

Source: Internet
Author: User
Tags chr microsoft frontpage
 
Obtain remote files
Response. write getHTTPPage ("http://www.111cn.net ")
Function getHTTPPage (url)
On error resume next
Dim http
Set http = Server. createobject ("Msxml2.XMLHTTP ")
Http. open "GET", url, false
Http. send ()
If Http. readystate <> 4 then exit function
GetHTTPPage = bytes2BSTR (Http. responseBody)
Set http = nothing
If err. number <> 0 then err. Clear
End function
Function bytes2BSTR (vIn)
Dim strReturn
Dim I, ThisCharCode, NextCharCode
StrReturn = ""
For I = 1 To LenB (vIn)
ThisCharCode = AscB (MidB (vIn, I, 1 ))
If ThisCharCode <& H80 Then
StrReturn = strReturn & Chr (ThisCharCode)
Else
NextCharCode = AscB (MidB (vIn, I + 1, 1 ))
StrReturn = strReturn & Chr (CLng (ThisCharCode) * & H100 + CInt (NextCharCode ))
I = I + 1
End If
Next
Bytes2BSTR = strReturn
End Function
--------------------------------------------------------------------
Obtain remote HTML file source code
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<Meta name = "GENERATOR" content = "Microsoft FrontPage 5.0">
<Meta name = "ProgId" content = "FrontPage. Editor. Document">
</Head>
<Body>
<Div id = "demo"> <div style = "width: 677; height: 70">
</Body>
</Html>
<Script language = vbscript>
Sub b3_onclick
Dim objXMLHTTP, xml
Set xml = CreateObject ("Microsoft. XMLHTTP ")
 
Xml. Open "GET", "http: // 192.168.8.15: 7001/wap_manage/login. asp", False
'Pull the data from the web page
Xml. Send
'Demo. innerhtml = xml. responseText
Related Article

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.