asp中xmlhttp组件发包
asp中xmlhttp组件发包
写的一个小偷函数,注意红色代码部分,其他的自己添加吧!
Function PostHttpPageFrom(HttpUrl,stra,FromUrl)
Dim Http
Set Http=server.createobject("MSXML2.XMLHTTP")
Http.open "POST",HttpUrl,False
Http.setrequestheader "content-length",len(stra) Http.setrequestheader "content-
type","application/x-www-form-urlencoded"
Http.setrequestheader "Referer",FromUrl
Http.send stra
If Http.Readystate<>4 then
Set Http=Nothing
GetHttpPage="$False$"
Exit function
End if
PostHttpPageFrom=bytesToBSTR(Http.responseBody,"gb2312") Set Http=Nothing
If Err.number<>0 then
Err.Clear
End If
End Function
Function BytesToBstr(Body,Cset)
Dim Objstream
Set Objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open1 d)
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
相关文章
利用xmlhttp和adodb.stream加缓存技术下载远程Web文件
利用xmlhttp和adodb.stream加缓存技术下载远程Web文件...2006-06-06
Asp定时执行操作 Asp定时读取数据库(网页定时操作详解)
由于目前部分网页语言的限制,在定时操作上有一定的困难,但是经过我多次的求证,发现第四种方法无疑是效果最好的,最省心的。2009-10-10


最新评论