登陆网站会员,并且使用登陆状态访问会员页面。注意不支持验证码
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001" EnableSessionState=False%><% Option Explicit Response.Buffer = True Response.ContentType = "text/html" Class n8v_7080_net Private xmlhttp Private Sub Class_Initialize():Set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP"):End Sub Private Sub Class_Terminate():End Sub Function GetForm(HTML) Dim Form_:Set Form_ = Server.CreateObject("Scripting.Dictionary") Dim regEx:Set regEx = New RegExp Dim Matches,Match,fname,fvalue With regEx .Pattern = "<input .+/>" .IgnoreCase = True .Global = True Set Matches = .Execute(HTML) For Each Match In Matches fname = Getatt(Match.Value,"name") If fname <> "" Then fvalue = Getatt(Match.Value,"value") Form_.add fname,fvalue End If Next End With Set GetForm = Form_ End Function Function Getatt(HTML,fname) Dim tmpValue,StartIndex tmpValue = HTML StartIndex = InStr(1,tmpValue," "&fname&"=""",0) If StartIndex > 0 Then tmpValue = Mid(HTML,StartIndex+3+len(fname)) tmpValue = Left(tmpValue,InStr(1,tmpValue,"""",0)-1) Getatt = tmpValue Else Getatt = "" End If End Function Public Function login(uid,pwd) Dim inputs,ReturnCode,SendValue,key xmlhttp.open "GET","http://n8v.7080.net/login.aspx",false xmlhttp.Send ReturnCode = xmlhttp.responseText Set inputs = GetForm(ReturnCode) inputs("userName") = uid inputs("userPassword") = pwd SendValue = "DropDownList1=1" For Each key In inputs SendValue = SendValue & "&" & key & "=" & Server.URLEncode(inputs(key)) Next With xmlhttp .open "POST","http://n8v.7080.net/login.aspx",false .setRequestHeader "Content-Type","application/x-www-form-urlencoded" .setRequestHeader "Referer","http://n8v.7080.net/login.aspx" .setRequestHeader "Content-Length",len(SendValue) .setRequestHeader "User-Agent","Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)" .Send SendValue End With End Function Public Function wget(url) xmlhttp.open "GET",url,false xmlhttp.setRequestHeader "Referer","http://n8v.7080.net/movie.aspx" xmlhttp.setRequestHeader "User-Agent","Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)" xmlhttp.Send wget = xmlhttp.responseText '改善显示效果 'wget = Replace(wget,"href=""","href=""http://n8v.7080.net/") 'wget = Replace(wget,"src=""","src=""http://n8v.7080.net/") 'wget = Replace(wget,"src='","src='http://n8v.7080.net/") End Function End Class Dim n:Set n = New n8v_7080_net n.login "2985623","a123456" '注意此类只能使用在 http://n8v.7080.net 中 '如下方法获取登陆后的内容 注意不可以注销类,否则登陆状态失效 Response.Write n.wget("http://n8v.7080.net/film.aspx?AreaId=1") 'dim i 'for i = 2 to 5 'Response.Write n.wget("http://n8v.7080.net/film.aspx?AreaId=2") 'Response.Write n.wget("http://n8v.7080.net/film.aspx?AreaId=3") 'Response.Write n.wget("http://n8v.7080.net/film.aspx?AreaId=4") 'next %> |
Leave a Reply