- 2013-12-11消息称,诺基亚Normandy和Asha一样,主打低端市场,将...
 - 2013-12-10雷军微博披露小米“魔方”项目
 - 2013-12-1012306购票首度接入支付宝 支付时间可以快至5秒
 - 2013-12-10中国移动官网显示周四接受iPhone 5s预订
 - 2013-12-0912306 App研发故事:变成开放系统 社会人员助力
 - 2013-10-15天猫“双十一”今年打通线上线下:实体店参与。
 - 2013-10-15根据专利显示iPhone将有防摔功能。
 - 2013-10-12百度或可全面收购人人网,传闻四起!
 - 2013-10-07生物密码时代何时到来?尚存隐私泄露隐忧
 - 2013-09-29国务院近日印发了上海自由贸易试验区总体方案,自贸区...
 
asp利用xmlhttp 组件抓取网页内容
  抓取网页。偶要实现实实更新天气预报。利用了XMLHTTP组件,抓取网页的指定部分。
  需要分件html源代码
  此例中的被抓取的html源代码如下
  <p align=left>2004年8月24日星期二;白天:晴有时多云南风3—4级;夜间:晴南风3—4级;气温:最高29℃最低19℃ </p>
  而程序中是从
  以2004年8月24日为关键字搜索,直到</p>结速
  而抓取的内容就变成了"2004年8月24日星期二;白天:晴有时多云南风3—4级;夜间:晴南风3—4级;气温:最高29℃最低19℃ "
  干干净净的了。记录一下。
<%
  On Error Resume Next
  Server.ScriptTimeOut=9999999
  Function getHTTPPage(Path)
  t = GetBody(Path)
  getHTTPPage=BytesToBstr(t,"GB2312")
  End function
  Function GetBody(url) 
  on error resume next
  Set Retrieval = CreateObject("Microsoft.XMLHTTP") 
  With Retrieval 
  .Open "Get", url, False, "", "" 
  .Send 
  GetBody = .ResponseBody
  End With 
  Set Retrieval = Nothing 
  End Function
  Function BytesToBstr(body,Cset)
  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 = Cset
  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
  %>
  <html>
  <BODY bgColor=#ffffff leftMargin=0 topMargin=0 MARGINHEIGHT=0 MARGINWIDTH=0>
  <!-- 开始 --> 
  <%
  Dim wstr,str,url,start,over,dtime
  dtime=Year(Date)&"年"&Month(Date)&"月"&Day(Date)&"日"
  url="http://www.qianhuaweb.com/"
  wstr=getHTTPPage(url)
  start=Newstring(wstr,dtime)
  over=Newstring(wstr,"</p>")
  body=mid(wstr,start,over-start)
  response.write "<MARQUEE onmouseover=this.stop(); onmouseout=this.start();>"&body&"</marquee>"
%>
  <!-- 结束 -->
  </body></html>
注:本站部分信息可能源于互联网分享,如有侵权,请告知,我们将及时删除!
- 用户评论
 - 相关文章
 
- 
								最新评论
 
- 
							1 
bash_profile和.bashr...
详细介绍bash_profile和.bashrc之间的区别。... - 
							2 
awstats的安装简易指南...
介绍awstats的安装使用,使其能快速部署。 - 
							3 
分布式监控系统gangli...
详细介绍ganglia配置过程 - 
							4 
使用IIS+Resin来配置J...
本文介绍使用IIS+Resin来配置JSP的运行环境... - 
							5 
MYSQL的主要参数设置(...
MYSQL的主要参数设置(优化) - 
							6 
Linux服务器安全小技巧...
Linux 服务器安全小技巧 









