asp中xmlhttp组件发包
2018-09-06 13:19
  asp中xmlhttp组件发包 
写的一个小偷函数,注意红色代码部分,其他的自己添加吧! 
FunctionPostHttpPageFrom(HttpUrl,stra,FromUrl) 
DimHttp 
SetHttp=server.createobject(MSXML2.XMLHTTP) 
Http.openPOST,HttpUrl,False 
Http.setrequestheadercontent-length,len(stra)Http.setrequestheadercontent- 
type,application/x-
Http.setrequestheaderReferer,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
上一篇:用ASP实现分级权限控制
下一篇:在ASP中操作数据库的方法