导航

闲谈

« xmlhttp可能的错误和解决方法ajax定义:搭建第一个ajax页面 »

简单小偷程序实例

实例出自落伍者论坛


<html>

<head>

<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>

<meta name='generator' content='默飞冲天'>

<meta name='keywords' content='默飞冲天'>

//niceidea 签名留念 :^

<style type=text/css>body {font-family:  Arial; font-size:  12px;color: #000000;}td {font-family:  Arial; font-size:  12px;line-height:20px;}a:link,a:visited{text-decoration: none; color:  #000000}a:hover {  color:  #ff0000; text-decoration: underline}</style>

<title>天气预报 - 默飞冲天</title>

</head>

<body>

<%

'制作:默飞

'QQ:33224360

'http://mofei.xinxiu.com

'天气预报最新适用采集程序

'声明取得目标信息的函数,通过XML组件进行实现。

Function GetURL(url)

Set Retrieval = CreateObject("Microsoft.XMLHTTP")

With Retrieval

.Open "GET", url, False

.Send

GetURL = bytes2bstr(.responsebody)

'对取得信息进行验证,如果信息长度小于100则说明截取失败

if len(.responsebody)<100 then

response.write "获取远程文件 <a href="&url&" target=_blank>"&url&"</a> 失败。"

response.end

end if

End With

Set Retrieval = Nothing

End Function

' 二进制转字符串,否则会出现乱码的!

function bytes2bstr(vin)

strreturn = ""

for i = 1 to lenb(vin)

thischarcode = ascb(midb(vin,i,1))

if thischarcode < &h80 then

strreturn = strreturn & chr(thischarcode)

else

nextcharcode = ascb(midb(vin,i+1,1))

strreturn = strreturn & chr(clng(thischarcode) * &h100 + cint(nextcharcode))

i = i + 1

end if

next

bytes2bstr = strreturn

end function

'声明截取的格式,从Start开始截取,到Last为结束

Function GetKey(HTML,Start,Last)

filearray=split(HTML,Start)

filearray2=split(filearray(1),Last)

GetKey=filearray2(0)

End Function

Dim Softid,Url,Html,Title

'把下面的[将乐]改成你的城市,就是你城市的天气预报了,可到www.tq121.com.cn里查一下,有没收录你的城市,一般到县级的都有。

Url="http://weather.tq121.com.cn/detail.php?city=将乐"

Html = GetURL(Url)

'搜索要偷取的内容的开始位置

Str_start = instr(Html, "预报发布时间")

Str_start = instr(Str_start, Html, "<table width=""979"" height=""185"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"">")

'搜索要偷取的内容的结束位置

Str_end = instr(Str_start, Html, "<table width=""979"" height=""105"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"">")

'截取内容

Html = Mid(Html, Str_start, Str_end - Str_start)

'调整表格

Html=replace(replace(Html,"width=""979""","width=100%"),"height=""185""","") '大表格

Html=replace(replace(Html,"width=""133""","width=95%"),"height=""183""","") '背景大小

Html=replace(replace(Html,"width=""973""",""),"height=""183""","")

Html=replace(replace(Html,"width=""113""","width=100%"),"height=""35""","") '日期表格

Html=replace(replace(Html,"width=""57""",""),"width=""56""","") '图片表格

Html=replace(replace(Html,"width=""50""",""),"height=""46""","")

Html=replace(replace(Html,"height=""57""",""),"height=""73""","")

Html=replace(Html,"width=""141""","width=14%") '表格分配

Html=replace(Html,"width=""140""","width=14%")

Html=replace(Html,"width=""139""","width=14%")

Html=replace(Html,"width=""133""","width=16%")

Html=replace(Html,"width=""125""","width=100%")

Html=replace(Html,"width=""107""","width=100%")

Html=replace(replace(Html,"../images/","images/"),"./images/","images/") '图片路径

response.write Html

'Response.Write"采集完毕!"

%>

</body>

</html>

  • 相关文章:
  • quote 4.成功的秘诀是什么
  • http://www.dggrmy.com/ganzaoji/shipin/
  • 成功的秘诀是什么?答“拼命吹”风说。“要能拍”照相机说。“要罩得住”蚊帐说。“无孔不入”钉子说。“口锋要锐利”刀子说。“容量要大”冰箱说。“永远保持冷静”冷气说。“有扫荡黑暗带来光明的本事”火说。“不要被人牵着鼻子走”茶壶说。食品干燥剂说:满足市场需求!想你的市场有多大!33
  • 2008-5-24 17:28:11 回复该留言

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

Search

控制面板

最新评论及回复

最近发表