复制代码代码如下:
<%@LANGUAGE="VBSCRIPT"CODEPAGE="936"%>
<!--#includefile="conn.asp"-->
<!--#includefile="inc/function.asp"-->
<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>UntitledDocument</title>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
<metahttp-equiv="refresh"content="300;URL=steal_house.asp">
</head>
<body>
<%
onerrorresumenext
'
Server.ScriptTimeout=999999
'========================================================
'字符编码函数
'====================================================
FunctionBytesToBstr(body,code)
dimobjstream
setobjstream=Server.CreateObject("adodb.stream")
objstream.Type=1
objstream.Mode=3
objstream.Open
objstream.Writebody
objstream.Position=0
objstream.Type=2
objstream.Charset=code
BytesToBstr=objstream.ReadText
objstream.Close
setobjstream=nothing
EndFunction
'取行字符串在另一字符串中的出现位置
FunctionNewstring(wstr,strng)
Newstring=Instr(lcase(wstr),lcase(strng))
ifNewstring<=0thenNewstring=Len(wstr)
EndFunction
'替换字符串函数
functionReplaceStr(ori,str1,str2)
ReplaceStr=replace(ori,str1,str2)
endfunction
'====================================================
functionReadXml(url,code,start,ends)
setoSend=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)
endfunction
functionSubStr(body,start,ends)
start=Instr(body,start)
SubStr=mid(body,start+len(start)+1)
ends=Instr(SubStr,ends)
SubStr=left(SubStr,ends-1)
endfunction
dimgetcont,NewsContent
dimurl,title
url="http://www.***.com"'新闻网址
getcont=ReadXml(url,"gb2312","<tableclass=k2border=""0""","</table>")
getcont=RegexHtml(getcont)
dimKeyId,NewsClass,City,Position,HouseType,Level,Area,Price,Demostra
dimContactMan,Contact
fori=2toubound(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>")