用户操作
[留言]  [发消息]  [加为好友] 
订阅我的博客
XML聚合    FeedSky
订阅到鲜果
订阅到Google
订阅到抓虾
fanenmin的公告
中国万网代理商(id:20267350) 专业域名注册、虚拟主机、主机托管、企业邮箱、网站建设、排名推广、企业短信、在线支付平台等服务价格低廉。 QQ:116726994 MSN:fanenmin@hotmail.com mail:fanenmin@163.com <script type="text/javascript"><!-- google_ad_client = "pub-2670824495915230"; google_ad_width = 160; google_ad_height = 600; google_ad_format = "160x600_as"; google_ad_type = "text_image"; //2007-01-23: 20070124 google_ad_channel = "3904934419"; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> <script type="text/JavaScript"> alimama_pid="mm_10993607_1363713_3099125"; alimama_titlecolor="0000FF"; alimama_descolor ="000000"; alimama_bgcolor="FFFFFF"; alimama_bordercolor="E6E6E6"; alimama_linkcolor="008000"; alimama_bottomcolor="FFFFFF"; alimama_anglesize="0"; alimama_bgpic="0"; alimama_icon="0"; alimama_sizecode="23"; alimama_width=160; alimama_height=600; alimama_type=2; </script> <script src="http://a.alimama.cn/inf.js" type=text/javascript> </script> <script type="text/JavaScript"> alimama_pid="mm_10993607_1363713_3099240"; alimama_titlecolor="0000FF"; alimama_descolor ="000000"; alimama_bgcolor="FFFFFF"; alimama_bordercolor="E6E6E6"; alimama_linkcolor="008000"; alimama_bottomcolor="FFFFFF"; alimama_anglesize="0"; alimama_bgpic="0"; alimama_icon="0"; alimama_sizecode="22"; alimama_width=120; alimama_height=240; alimama_type=2; </script> <script src="http://a.alimama.cn/inf.js" type=text/javascript> </script>
文章分类
安家置业
新浪房产_新浪网
存档

原创  从新浪首页获取重要新闻 收藏

http://localhost:3148/test2/Default7.aspx

从新浪首页获取重要新闻

<%@ Import NameSpace="System.Net" %>
<script language="VB" runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
 '下面首先将新浪网站首页数据下载到字符串strTemp中
 Dim wc As New WebClient()    
 Dim strTemp As String   
 strTemp = Encoding.Default.GetString(wc.DownloadData("http://www.sina.com.cn")) 
 '下面在该字符串中查找重要新闻
 Dim intStart,intEnd As Integer      '两个变量分别表示开始和结束位置
        intStart = strTemp.IndexOf("<!-- 新闻列表 begin -->", 0) + 24
        intEnd = strTemp.IndexOf("<!-- 新闻列表 end -->", intStart) - 1
 strTemp = strTemp.Substring(intStart, intEnd - intStart + 1) '从中提取重要新闻
 Message.Text = strTemp           '显示重要新闻
End Sub
</script>
<html>
<body>
 <h3 align="center">从新浪首页获取重要新闻</h3>
 <asp:Label id="message" runat="server" />
</body>
</html>

发表于 @ 2009年03月01日 14:27:00 | 评论( loading... ) | 编辑| 举报| 收藏

旧一篇:从URL下载数据到本地文件 | 新一篇:从指定网页自动下载其中所有的图片

  • 发表评论
  • 评论内容:
  •  
Copyright © fanenmin
Powered by CSDN Blog