中国站长下载-为中国站长提供最好最全的建站资源! 首 页发布资源有事留言繁體中文
设为首页
加入收藏
联系我们
 
您当前的位置:中国站长下载 -> 文章中心 -> 网页编程 -> ASP编程 -> 文章内容  虚拟主机 域名注册 退出登录 用户管理
栏目导航
· ASP编程 · .NET编程
· PHP编程 · JSP编程
· CGI 专区
热门文章
· sndvol32 - sndvol3...
· [组图] FLASH:《大话李白》...
· 个人网站到底能赚多...
· [图文] Rundll.exe是病毒吗...
· [组图] Flash:制作MV
· 价值12万元的网站SE...
· 网站创业者,你需要...
· 一个成功的网站设计...
· [图文] FLASH:韩国导航条解...
· 中国网站的赚钱模式...
相关文章
· [图文] 实例讲解asp抓取网上...
· 实例讲解asp抓取网上...
· 实例讲解ASP实现抓取...
· 实例讲解Windows 20...
· 一个实例讲解MySQL查...
实例讲解ASP实现抓取网上房产信息(10
作者:不详  来源:不详  发布时间:2006-8-13 0:22:45  发布人:chinazhan

 减小字体 增大字体

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

 
[] [返回上一页] [打 印] [收 藏]
∷相关文章评论∷    (评论内容只代表网友观点,与本站立场无关!) [更多评论...]
中国站长下载
中国站长下载

本页只接受PR>=4 IT类站点连接,申请连接,谢谢您们的支持!希望我们的下载站能够真正帮到中国的站长们!
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站地图
Copyright © 2005-2006 ChinaZhan.Net. All Rights Reserved .