Generating HTML pages with XMLHTTP

Source: Internet
Author: User
Tags end save file
xml| Generate html| Page

<% ' definition xmlhttp
function Getxmltext (URL)
Dim getxmlhttp

Set Getxmlhttp=server. CreateObject ("Microsoft.XMLHTTP")
Getxmlhttp.open "Get", Url,false, "" "," "
Getxmlhttp.send
' Getxmltext=getxmlhttp.responsetext
Getxmltext=getxmlhttp.responsebody
Set getxmlhttp=nothing
End Function

convert to character
Function bytestobstr (body,cset)
        Dim objstream
        Set objstream = Server.CreateObject ("ADODB.stream")
        objstream. Type = 1
        objstream. Mode =3
        objstream. Open
        objstream. Write body
        objstream. Position = 0
        objstream. Type = 2
        objstream. Charset = Cset
        bytestobstr = objstream. ReadText
        objstream. Close
        Set objstream = no
end Function

' Save file
Sub SaveToFile (Strbody,file)
Dim objstream
Set objstream = Server.CreateObject ("ADODB. Stream ")
With Objstream
. Type = 2
. Open
. Charset = "GB2312"
. Position = Objstream.size
. WRITETEXT = Strbody
. SaveToFile Server.MapPath (File), 2
. Close
End With
Set objstream = Nothing
End Sub
%>

<% savefile bytestobstr (Getxmltext ("http://127.0.0.1/index.asp"), "GB2312"), "index.htm"%>



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.