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