Cookies

来源:互联网 发布:java sleep wait 区别 编辑:程序博客网 时间:2024/04/29 23:14

<%
Function GetSourceInfo(byval url,pages,Cookies)
    dim xmlhttp,xmlget,bgpos,endpos
    Set xmlhttp = CreateObject("Msxml2.ServerXMLHTTP") 
    With xmlhttp
    .Open "POST", url, False
    .setRequestHeader "CONTENT-TYPE","application/x-www-form-urlencoded"
    '.setRequestHeader("Referer","来路的绝对地址")
    '.setRequestHeader "Cookie",Cookies   'Cookie
    .Send pages'post的参数
    xmlget = bin2str(.responseBody)
    End With 
    set xmlhttp = nothing
    GetSourceInfo=xmlget
End Function
Function bin2str(binstr)
    Const adTypeBinary = 1
    Const adTypeText = 2
    Dim BytesStream,StringReturn
    Set BytesStream = Server.CreateObject("ADODB.Stream") '建立一个流对象
    With BytesStream
    .Type = adTypeText
    .Open
    .WriteText binstr
    .Position = 0
    .Charset = "GB2312"
    .Position = 2
    StringReturn = .ReadText
    .close
    End With
    Set BytesStream = Nothing
    bin2str = StringReturn
End Function
'--------------------------------------------------------------------------------------
Cookies = ""
pages = "curDate=2005-12-20&FlightWay1=Single&FlightWay=Single&Homecity="&escape("成都")&"&DDatePeriod1=2005-12-25&startPeriod=All&Destcity1="&escape("深圳")&"&TicketAgency_List="&escape("成都")&"&ChildType=ADU&Quantity=1&DSeatClass=Y&airlineChoice=All"

'GetSourceInfo(网址,提交的表单,Cookies)
response.write(GetSourceInfo("http://www.ctrip.com/supermarket/Flight/SuperFlightSearchResult.asp",pages,Cookies))
%>

原创粉丝点击