<% Server.ScriptTimeOut=9999999 '---------------------------------------------------------------------------------------------------- ' ' 感谢你使用 非常小偷 ! ' ' 本代码完全公开和免费,你可以任意复制、传播、修改和使用, ' 但不得公开发表代码 不得用做商业用途,不得向其他使用者收费。 ' ' 使用时,请保留此段信息,谢谢配合 ' ' 非常小偷的网站:http://www.laoman.com/verythief/ ' '---------------------------------------------------------------------------------------------------- Class Cls_Thief Private Value_ Private Source_ Private IsGet_ Private Method_ Private Input_ Private objectStream,StringReturn Private objectHttp Private Sub Class_Initialize() Value_ = 0 Source_ = "http://news.sina.com.cn/hotnews/" Method_ = "GET" IsGet_ = False End Sub Private Sub Class_Terminate() 'statements End Sub Public Property Get Version Version = "VeryThief 20051006" End Property Public Property Let Source(ByVal vNewValue) Source_ = vNewValue End Property Public Property Let Method(ByVal vNewValue) If vNewValue <> "POST" Then vNewValue = "GET" Method_ = vNewValue End Property Public Property Let Input(ByVal vNewValue) Input_ = vNewValue End Property Public Property Get Value Value = Value_ End Property Private Function Bytes2bStr(vin, Charset) On Error Resume Next Set objectStream = Server.CreateObject("ADODB.Stream") With objectStream .Type = 2 .Mode = 3 .Open .WriteText vin .Position = 0 .Charset = Charset .Position = 2 StringReturn = .ReadText .Close End With Set objectStream = Nothing Bytes2bStr = StringReturn End Function Public Sub Steal() If Source_ <> "" Then On Error Resume Next Set objectHttp=Server.CreateObject("MSXML2.XMLHTTP") objectHttp.Open Method_,Source_,False If Method_ = "POST" Then objectHttp.SetRequestHeader "CONTENT-TYPE","application/x-www-form-urlencoded" objectHttp.Send(Input_) Else objectHttp.Send() End If If objectHttp.ReadyState <> 4 Then Exit Sub End If Value_ = Bytes2bStr(objectHttp.ResponseBody,"gb2312") IsGet_ = True Set objectHttp = Nothing If Err.Number <> 0 Then Err.Clear Else Value_ = 0 End If End Sub Public Sub noReturn() Value_ = Replace(Value_, vbCr, "") Value_ = Replace(Value_, vbLf, "") Value_ = Replace(Value_, vbTab, "") End Sub Public Function Change(code, OldString, NewString) Change = Replace(code, OldString, NewString) End Function Public Function Cut(code, head, bottom) If InStr(code, head) > 0 And InStr(code, bottom) > 0 Then Cut = Mid(code, InStr(code, head) + Len(head), InStr(code, bottom) - InStr(code, head) - Len(head)) Else Cut = 0 End If End Function Public Function CutX(code, head, bottom) If InStr(code, head) > 0 And InStr(code, bottom) > 0 Then CutX = Mid(code, InStr(code, head), InStr(code, bottom)- InStr(code, head)+ Len(bottom)) Else CutX = 0 End If End Function Public Function CutBy(code, head, headCusor, bottom, bottomCusor) If InStr(code, head) > 0 And InStr(code, bottom) > 0 Then CutBy = Mid(code, InStr(code, head) + Len(head) + headCusor, InStr(code, bottom) - 1 + bottomCusor - InStr(code, head) - Len(head) - headcusor) Else CutBy = 0 End If End Function Public Function Filt(code, head, bottom, str) If InStr(code, head) > 0 And InStr(code, bottom) > 0 Then Filt = Replace(code, Mid(code, InStr(code, head) + Len(head), InStr(code, bottom) - InStr(code, head) - Len(head)), str) Else Filt = 0 End If End Function Public Function FiltX(code, head, bottom, str) If InStr(code, head) > 0 And InStr(code, bottom) > 0 Then FiltX = Replace(code, Mid(code, InStr(code, head), InStr(code, bottom) - InStr(code, head) + Len(bottom)), str) Else FiltX = 0 End If End Function Public Function FiltBy(code, head, headCusor, bottom, bottomCusor, str) If InStr(code, head) > 0 And InStr(code, bottom) > 0 Then FiltBy = Replace(code, Mid(code, InStr(code, head) + Len(head) + headCusor, InStr(code, bottom) - 1 + bottomCusor - InStr(code, head) - Len(head) - headcusor), str) Else FiltBy = 0 End If End Function Public Function ReBuild(code, str) ReBuild= Replace(code, str, "<!--VeryThief-->") End Function Public Sub DeBug() Response.Write "<script language=""JavaScript"" type=""text/JavaScript"">"& vbNewLine Response.Write "<!--"& vbNewLine Response.Write "function Opera() {"& vbNewLine Response.Write vbTab & "var sourcecode=event.srcElement.parentElement.children[0].value;"& vbNewLine Response.Write vbTab & "var newwindow=window.open('','','');"& vbNewLine Response.Write vbTab & "newwindow.opener = null;"& vbNewLine Response.Write vbTab & "newwindow.document.write(sourcecode);"& vbNewLine Response.Write vbTab & "newwindow.document.close();"& vbNewLine Response.Write "}"& vbNewLine Response.Write "//-->"& vbNewLine Response.Write "</script>"& vbNewLine Response.Write "<textarea cols=""120"" rows=""32"" wrap=""VIRTUAL"">"& vbNewLine Response.Write HTMLEncode(Value_) & vbNewLine Response.Write "</textarea>"& vbNewLine Response.Write "<input type=""button"" onClick=""javascript:Opera();"" value=""Operate codes"">" End Sub Private Function HTMLEncode(String) If String = "" Or String = "0" Then : Exit Function String = Replace(String, "&", "&") String = Replace(String, ">", ">") String = Replace(String, "<", "<") String = Replace(String, Chr(34), """) String = Replace(String, Chr(39), "´") HTMLEncode = String End Function End Class %> 我看不懂。。会用的教一下吧~
PHP: <!--#include file="Thief.asp"--><%Dim ThiefSet Thief = New Cls_ThiefThief.Method="GET"Thief.Source="http://www.chinahtml.com/index.shtml"Thief.StealThief.noReturnThief.debug()Response.Write Thief.Version%> 将你的代码保存Thief.asp, 其实就是一个class,你看看上面那个,就明白咋回事了。
PHP: <% Dim Thief,title,code Set Thief = New Cls_Thief Thief.Method="GET" Thief.Source="http://www.chinahtml.com/index.shtml" Thief.Steal 'Thief.noReturn 'Thief.debug() code =Thief.value title =Thief.Cut(code, "<title>", "</title>") Response.write title '获取标题 '其他的方法一样 %>
还再具体,,我晕,你将你的代码保存为一个文件,用include 包含进来,其实它本身是一个class类文件, 你就按照asp的类使用就可以实现了。 第一步是定义使用类, Dim Thief,title,code Set Thief = New Cls_Thief 接下来: Private Sub Class_Initialize() Value_ = 0 Source_ = "http://news.sina.com.cn/hotnews/" Method_ = "GET" IsGet_ = False End Sub 初始化有三个属性,你可以自己定义, Thief.Method="GET" Thief.Source="http://www.chinahtml.com/index.shtml" 接着三方法 Thief.Steal ’获取页面的值 'Thief.noReturn '祛除空白行 'Thief.debug() '使用debug调试看看, 接下来获得返回值, code =Thief.value 再下面就是普通的函数截取操作, 手册说的很明白了。