Set oXMLHttp = nothing
GetHtml = cHtmStr
End Function
Function GetBytes2BSTR(p_cHtmlStr)
dim cReturnStr
dim i,n
cReturnStr = ""
n = LenB(p_cHtmlStr)
For i = 1 To n
dim cCharCode
dim cNextCharCode
cCharCode = AscB( MidB(p_cHtmlStr, i, 1) )
If (cCharCode < &H80) Then
cReturnStr = cReturnStr & Chr(cCharCode)
Else
cNextCharCode = AscB( MidB(p_cHtmlStr, i+1, 1) )
cReturnStr = cReturnStr & Chr(CLng(cCharCode) * &H100 + CInt(cNextCharCode))
i = i + 1
End If
Next
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP")
xmlhttp.open("GET","http://www.sohu.com",false)
xmlhttp.onreadystatechange = rep
xmlhttp.send()
function rep(){
if (xmlhttp.readyState==4){
var xmldoc = new ActiveXObject("Microsoft.XMLDOM")
xmldoc.loadXML('<?xml version="1.0"?><root/>')
var file = xmldoc.createElement("file")
file.dateType = "bin.hex"
file.nodeTypedValue = xmlhttp.responseBody
xmldoc.documentElement.appendChild(file)
var xhttp = new ActiveXObject("Microsoft.XMLHTTP")
xhttp.open("POST","save.asp",true)
xhttp.send(xmldoc)
}
}
save.asp
<%
Dim xmldoc : Set xmldoc = Server.CreateObject("MSXML2.DOMDocument")
xmldoc.async = false
xmldoc.load Request
If xmldoc.parseError.errorCode=0 Then
Dim file : file = xmldoc.selectSingleNode("/root/file").nodeTypedValue
Dim st : set st = Server.CreateObject("adodb.stream")
st.type = 1
st.open
st.write file
st.saveToFile Server.MapPath("sohu.htm")
set st = Nothing
End If
%>
<script language="vbscript">
Function bytes2BSTR(vIn)
Dim strReturn,i,ThisCharCode,innerCode,Hight8,Low8,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
</script>
<script language=javascript>
var oDiv //添加用的节点
var nP //DIV的 padding-left
var xh //xmlhttp
function getXML()
{
oDiv = document.all.m
oDiv.innerHTML = "正在装载栏目数据,请稍侯......."
oDiv.style.display= ""
xh = new ActiveXObject("Microsoft.XMLHTTP")
xh.onreadystatechange = getReady
xh.open("GET",a.value,true)
xh.send()
}
function getReady()
{
if(xh.readyState==4)
{
if(xh.status==200)
{