当前位置: 网学 > 编程文档 > ASP > 正文

asp采集抓取网上房产信息的代码

来源:Http://myeducs.cn 联系QQ:点击这里给我发消息 作者: 用户投稿 来源: 网络 发布时间: 13/06/16
r(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
''==================================================

next
function RemoveTag(body)
Set regEx = New RegExp
regEx.Pattern = "<[a].*?<\/[a]>"
regEx.IgnoreCase = True
regEx.Global = True
Set Matches = regEx.Execute(body)
dim i,arr(15),ifexit
i=0
j=0
For Each Match in Matches
TempStr = Match.Value
TempStr=replace(TempStr,"<td>","")
TempStr=replace(TempStr,"</td>","")
TempStr=replace(TempStr,"<tr>","")
TempStr=replace(TempStr,"</tr>","")
arr(i)=TempStr
i=i+1
if(i>=15) then
exit for
end if
Next
Set regEx=nothing
Set Matches =nothing
RemoveTag=arr

end function
function RegexHtml(body)
dim r_arr(47),r_temp
Set regEx2 = New RegExp
regEx2.Pattern ="<a.*?<\/a>"
regEx2.IgnoreCase = True
regEx2.Global = True
Set Matches2 = regEx2.Execute(body)
iii=0
For Each Match in Matches2

r_arr(iii)=Match.Value

iii=iii+1
Next
RegexHtml=r_arr
set regEx2=nothing
set Matches2=nothing
end function
''======================================================
conn.close
set conn=nothing
%>
</body>
</html>

  • 下一篇资讯: ASP注册登陆实例代码
  • 网学推荐

    免费论文

    原创论文

    浏览:
    设为首页 | 加入收藏 | 论文首页 | 论文专题 | 设计下载 | 网学软件 | 论文模板 | 论文资源 | 程序设计 | 关于网学 | 站内搜索 | 网学留言 | 友情链接 | 资料中心
    版权所有 QQ:3710167 邮箱:3710167@qq.com 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
    Copyright 2008-2015 myeducs.Cn www.myeducs.Cn All Rights Reserved
    湘ICP备09003080号