|
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> aQrLinux联盟 <!-- #include file="conn.asp" --> aQrLinux联盟 aQrLinux联盟 <!-- #include file="inc/function.asp" --> aQrLinux联盟 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> aQrLinux联盟 <html> aQrLinux联盟 <head> aQrLinux联盟 <title>Untitled Document</title> aQrLinux联盟 <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> aQrLinux联盟 <meta http-equiv="refresh" content="300;URL=steal_house.asp"> aQrLinux联盟 </head> aQrLinux联盟 aQrLinux联盟 <body> aQrLinux联盟 <% aQrLinux联盟 on error resume next aQrLinux联盟 ' aQrLinux联盟 Server.ScriptTimeout = 999999 aQrLinux联盟 '================================ aQrLinux联盟 '字符编码函数 aQrLinux联盟 '======================================== aQrLinux联盟 Function BytesToBstr(body,code) aQrLinux联盟 dim objstream aQrLinux联盟 set objstream = Server.CreateObject("adodb.stream") aQrLinux联盟 objstream.Type = 1 aQrLinux联盟 objstream.Mode =3 aQrLinux联盟 objstream.Open aQrLinux联盟 objstream.Write body aQrLinux联盟 objstream.Position = 0 aQrLinux联盟 objstream.Type = 2 aQrLinux联盟 objstream.Charset =code aQrLinux联盟 BytesToBstr = objstream.ReadText aQrLinux联盟 objstream.Close aQrLinux联盟 set objstream = nothing aQrLinux联盟 End Function aQrLinux联盟 aQrLinux联盟 '取行字符串在另一字符串中的出现位置 aQrLinux联盟 Function Newstring(wstr,strng) aQrLinux联盟 Newstring=Instr(lcase(wstr),lcase(strng)) aQrLinux联盟 if Newstring<=0 then Newstring=Len(wstr) aQrLinux联盟 End Function aQrLinux联盟 '替换字符串函数 aQrLinux联盟 function ReplaceStr(ori,str1,str2) aQrLinux联盟 ReplaceStr=replace(ori,str1,str2) aQrLinux联盟 end function aQrLinux联盟 '==================================aQrLinux联盟 function ReadXml(url,code,start,ends) aQrLinux联盟 set oSend=createobject("Microsoft.XMLHTTP") aQrLinux联盟 SourceCode = oSend.open ("GET",url,false) aQrLinux联盟 oSend.send() aQrLinux联盟 ReadXml=BytesToBstr(oSend.responseBody,code ) aQrLinux联盟 start=Instr(ReadXml,start) aQrLinux联盟 ReadXml=mid(ReadXml,start) aQrLinux联盟 ends=Instr(ReadXml,ends) aQrLinux联盟 ReadXml=left(ReadXml,ends-1) aQrLinux联盟 end function aQrLinux联盟 aQrLinux联盟 function SubStr(body,start,ends) aQrLinux联盟 start=Instr(body,start) aQrLinux联盟 SubStr=mid(body,start+len(start)+1) aQrLinux联盟 ends=Instr(SubStr,ends) aQrLinux联盟 SubStr=left(SubStr,ends-1) aQrLinux联盟 end function aQrLinux联盟 aQrLinux联盟 dim getcont,NewsContent aQrLinux联盟 dim url,title aQrLinux联盟 url="http://www.***.com"'新闻网址knowsky.com aQrLinux联盟 getcont=ReadXml(url,"gb2312","<table class=k2 border=""0""","</table>") aQrLinux联盟 getcont=RegexHtml(getcont) aQrLinux联盟 dim KeyId,NewsClass,City,Position,HouseType,Level,Area,Price,Demostra aQrLinux联盟 aQrLinux联盟 dim ContactMan,Contact aQrLinux联盟 for i=2 to ubound(getcont) aQrLinux联盟 response.Write(getcont(i)&"__<br>") aQrLinux联盟 aQrLinux联盟 tempLink=mid(getcont(i),instr(getcont(i),"href=""")+6,instr(getcont(i),""" onClick")-10) aQrLinux联盟 tempLink=replace(tempLink,"../","") aQrLinux联盟 aQrLinux联盟 response.Write(i&":"&tempLink&"<br>") aQrLinux联盟 NewsContent=ReadXml(tempLink,"gb2312","<td valign=""bottom"" width=""400"">","<hr width=""760"" noshade size=""1"" color=""#808080""> ") aQrLinux联盟 NewsContent=RemoveHtml(NewsContent) aQrLinux联盟 NewsContent=replace(NewsContent,VbCrLf,"") aQrLinux联盟 NewsContent=replace(NewsContent,vbNewLine,"") aQrLinux联盟 NewsContent=replace(NewsContent," ","") aQrLinux联盟 NewsContent=replace(NewsContent," ","") aQrLinux联盟 NewsContent=replace(NewsContent," ","") aQrLinux联盟 NewsContent=replace(NewsContent,"\n","") aQrLinux联盟 NewsContent=replace(NewsContent,chr(10),"") aQrLinux联盟 NewsContent=replace(NewsContent,chr(13),"") aQrLinux联盟 '===============get Content======================= aQrLinux联盟 response.Write(NewsContent) aQrLinux联盟 KeyId=SubStr(NewsContent,"列号:","信息类别:") aQrLinux联盟 NewsClass=SubStr(NewsContent,"类别:","所在城市:") aQrLinux联盟 City=SubStr(NewsContent,"城市:","房屋具体位置:") aQrLinux联盟 Position=SubStr(NewsContent,"位置:","房屋类型:") aQrLinux联盟 HouseType=SubStr(NewsContent,"类型:","楼层:") aQrLinux联盟 Level=SubStr(NewsContent,"楼层:","使用面积:") aQrLinux联盟 Area=SubStr(NewsContent,"面积:","房价:") aQrLinux联盟 Price=SubStr(NewsContent,"房价:","其他说明:") aQrLinux联盟 Demostra=SubStr(NewsContent,"说明:","联系人:") aQrLinux联盟 ContactMan=SubStr(NewsContent,"联系人:","联系方式:") aQrLinux联盟 Contact=SubStr(NewsContent,"联系方式:","信息来源:") aQrLinux联盟 response.Write("总序列号:"&KeyId&"<br>") aQrLinux联盟 response.Write("信息类别:"&NewsClass&"<br>") aQrLinux联盟 response.Write("所在城市:"&City&"<br>") aQrLinux联盟 response.Write("房屋具体位置:"&Position&"<br>") aQrLinux联盟 response.Write("房屋类型:"&HouseType&"<br>") aQrLinux联盟 response.Write("楼层:"&Level&"<br>") aQrLinux联盟 response.Write("使用面积:"&Area&"<br>") aQrLinux联盟 response.Write("房价:"&Price&"<br>") aQrLinux联盟 response.Write("其他说明:"&Demostra&"<br>") aQrLinux联盟 response.Write("联系人:"&ContactMan&"<br>") aQrLinux联盟 response.Write("联系方式:"&Contact&"<br>") aQrLinux联盟 'title=RemoveHTML(aa(i)) aQrLinux联盟 'response.Write("title:"&title) aQrLinux联盟 for n=0 to application.Contents.count aQrLinux联盟 if(application.Contents(n)=KeyId) then aQrLinux联盟 ifexit=true aQrLinux联盟 end if aQrLinux联盟 next aQrLinux联盟 if not ifexit then aQrLinux联盟 application(time&i)=KeyId aQrLinux联盟 '添加到数据库 aQrLinux联盟 '=============================== aQrLinux联盟 set rs=server.CreateObject("adodb.recordset") aQrLinux联盟 rs.open "select top 1 * from news order by id desc",conn,3,3 aQrLinux联盟 rs.addnew aQrLinux联盟 rs("NewsClass")=NewsClass aQrLinux联盟 rs("City")=City aQrLinux联盟 rs("Position")=Position aQrLinux联盟 rs("HouseType")=HouseType aQrLinux联盟 rs("Level")=Level aQrLinux联盟 rs("Area")=Area aQrLinux联盟 rs("Price")=Price aQrLinux联盟 rs("Demostra")=Demostra aQrLinux联盟 rs("ContactMan")=ContactMan aQrLinux联盟 rs("Contact")=Contact aQrLinux联盟 rs.update aQrLinux联盟 rs.close aQrLinux联盟 set rs=nothing aQrLinux联盟 end if aQrLinux联盟 '=========================================
Linux联盟收集整理 ,转贴请标明原始链接,如有任何疑问欢迎来本站Linux论坛讨论 |
|