Last active
December 21, 2015 20:39
-
-
Save Leask/6362726 to your computer and use it in GitHub Desktop.
A RSS fetching demo in ASPX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <title>RSS 新闻采集程序 Demo</title> | |
| </head> | |
| <body> | |
| <p>RSS 新闻采集程序 Demo</p> | |
| <br> | |
| <br> | |
| <p> | |
| <p>Demo A: 新华网国际新闻</p> | |
| <% | |
| Set http = Server.CreateObject("Microsoft.XMLHTTP") | |
| http.Open "GET","http://rss.xinhuanet.com/rss/world.xml", False | |
| http.send | |
| Set xml = Server.CreateObject("Microsoft.XMLDOM") | |
| xml.Async = False | |
| xml.ValidateOnParse = False | |
| xml.Load(http.ResponseXML) | |
| Set item = xml.getElementsByTagName("item") | |
| For i = 0 To (item.Length - 1) | |
| Set title = item.Item(i).getElementsByTagName("title") | |
| Set link = item.Item(i).getElementsByTagName("link") | |
| set description = item.Item(i).getElementsByTagName("description") | |
| set pubDate = item.Item(i).getElementsByTagName("pubDate") | |
| Response.Write("<a href=" & link.Item(0).Text & ">" & | |
| title.Item(0).Text & "</a>" & "<br>" & description.Item(0).Text & | |
| "<br>" & pubdate.Item(0).Text & "<hr />") | |
| Next | |
| %> | |
| </p> | |
| <br> | |
| <p> | |
| <p>Demo B: 新华网图片新闻</p> | |
| <% | |
| Set http = Server.CreateObject("Microsoft.XMLHTTP") | |
| http.Open "GET","http://rss.xinhuanet.com/rss/photos.xml", False | |
| http.send | |
| Set xml = Server.CreateObject("Microsoft.XMLDOM") | |
| xml.Async = False | |
| xml.ValidateOnParse = False | |
| xml.Load(http.ResponseXML) | |
| Set item = xml.getElementsByTagName("item") | |
| For i = 0 To (item.Length - 1) | |
| Set title = item.Item(i).getElementsByTagName("title") | |
| Set link = item.Item(i).getElementsByTagName("link") | |
| set description = item.Item(i).getElementsByTagName("description") | |
| set pubDate = item.Item(i).getElementsByTagName("pubDate") | |
| Response.Write("<a href=" & link.Item(0).Text & ">" & | |
| title.Item(0).Text & "</a>" & "<br>" & description.Item(0).Text & | |
| "<br>" & pubdate.Item(0).Text & "<hr />") | |
| Next | |
| %> | |
| </p> | |
| <br> | |
| <p> | |
| <p>Demo C: 太平洋软件下载</p> | |
| <% | |
| Set http = Server.CreateObject("Microsoft.XMLHTTP") | |
| http.Open "GET","http://dl.pconline.com.cn/rss/soft1.xml",False | |
| http.send | |
| Set xml = Server.CreateObject("Microsoft.XMLDOM") | |
| xml.Async = False | |
| xml.ValidateOnParse = False | |
| xml.Load(http.ResponseXML) | |
| Set item = xml.getElementsByTagName("item") | |
| For i = 0 To (item.Length-1) | |
| Set title = item.Item(i).getElementsByTagName("title") | |
| Set link = item.Item(i).getElementsByTagName("link") | |
| set description = item.Item(i).getElementsByTagName("description") | |
| set pubDate = item.Item(i).getElementsByTagName("pubDate") | |
| Response.Write("<a href=" & link.Item(0).Text & ">" & | |
| title.Item(0).Text & "</a>" & "<br>" & description.Item(0).Text & | |
| "<br>" & pubdate.Item(0).Text & "<hr />") | |
| Next | |
| %> | |
| </p> | |
| <br> | |
| <br> | |
| <p>Power by Leask with a Mac</p> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment