asp中xmlhttp组件发包
写的一个小偷函数,注意红色代码部分,其他的自己添加吧!
FunctionPostHttpPageFrom(HttpUrl,stra,FromUrl)
DimHttp
SetHttp=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.sendstra
IfHttp.Readystate<>4then
SetHttp=Nothing
GetHttpPage="$False$"
Exitfunction
Endif
PostHttpPageFrom=bytesToBSTR(Http.responseBody,"gb2312")SetHttp=Nothing
IfErr.number<>0then
Err.Clear
EndIf
EndFunction
FunctionBytesToBstr(Body,Cset)
DimObjstream
SetObjstream=Server.CreateObject("adodb.stream")
objstream.Type=1
objstream.Mode=3
objstream.Open1d)
objstream.Writebody
objstream.Position=0
objstream.Type=2
objstream.Charset=Cset
BytesToBstr=objstream.ReadText
objstream.Close
setobjstream=nothing
EndFunction