登陆网站会员,并且使用登陆状态访问会员页面。注意不支持验证码
<%@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 = ""
.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