1.POST方式
Sub submit1_onmouseup
Dim objXML, objXSL, objFSO,strFile, strFileName, strXSL,strURL, theString,TheForm
Set TheForm = Document.wordfind
window.status="正在检索数据···"
strURL="dns2.asp" ' 服务器侦听页地址
Set objXML = CreateObject("Microsoft.XMLHTTP") '创建MS的XMLHTTP组件
stra = "submit=submit&fqdn="&TheForm.webname.value
objXML.Open "post",strURL,false '采用Post提交方式;
objXML.setrequestheader "content-length",len(stra)
objXML.setrequestheader "content-type","application/x-www-form-urlencoded"
objXML.send stra ' 发送信息
xmlGet = objXML.responsebody '稍等片刻后,得到服务器端传回来的结果;
xmlGet = bytes2bstr(xmlGet) '将单字节转换成文本格式函数,源程序可以下面的dns2.asp程序中找到;
TheForm.comments.value=xmlGet
Set objXML = Nothing
end sub
2.GET方式
Set xmlhttp = server.CreateObject("Msxml2.XMLHTTP")
m_queryURL = "http://www.microsoft.com/china/technet/security/current.mspx"
XMLHTTP.Open "GET", m_queryURL, false
XMLHTTP.send()
s = XMLHTTP.responseBody
aa = Bytes2bStr(s,"GB2312")
3.BTSTR
Function Bytes2bStr(vin,cSet)
Dim BytesStream,StringReturn
Set BytesStream = Server.CreateObject("ADODB.Stream")
BytesStream.Type = 2
BytesStream.Open
BytesStream.WriteText vin
BytesStream.Position = 0
BytesStream.CharSet = cSet
BytesStream.Position = 2
StringReturn =BytesStream.ReadText
BytesStream.close
Set BytesStream = Nothing
Bytes2bStr = StringReturn
End Function
Function Str2B(Str)
For i = 1 To len(Str)
Str2B = Str2B&ChrB(Asc(Mid(Str,i,1)))
Next
End Function
Function B2Str(Str)
For i = 1 To LenB(Str)
ThisCharCode = AscB(MidB(Str,i,1))
If ThisCharCode < &H80 Then
B2Str = B2Str & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(Str,i+1,1))
B2Str = B2Str & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
End Function
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/182796/viewspace-893489/ ,如需转载,请注明出处,否则将追究法律责任。