ASP生成RSS

<!--
= * = = * = = * = = * = = * = = * = = * = = * = = * = = * = = * = = * 
*    作 者:  我本有心
=    QQ:     381584252
*     E-Mail: hztgcl1986@163.com
=     轉載請註明出處及作者!
*     版權所有,侵權必究!!!
=
*    http://www.8848so.com,人物搜索,8848So    
= * = = * = = * = = * = = * = = * = = * = = * = = * = = * = = * = = * 
-->
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#Include Virtual="Inc/Conn.asp"-->
<%
Response.Charset 
= "gb2312"
Response.ContentType
="text/xml" 

Dim sql,manid

manid 
= Trim(Request.QueryString("manid"))
If IsNumeric(manid) Then
    sql 
= "Select Top 10 ID,Title,Content,Link,NewsDT,RealName,AddRealName From [V-UserNews] Where DataID="&manid&" Order By ID Desc"
Else
    sql 
= "Select Top 10 ID,Title,Content,Link,NewsDT,RealName,AddRealName From [V-UserNews] Order By ID Desc"
End If

Set rs = cn.Execute(sql)

Response.Write(
"<?xml version=""1.0"" encoding=""gb2312"" ?>")
Response.Write(
"<rss version=""2.0"">")
Response.Write(
"<channel>")
Response.Write(
"<title>8848So.com 人物新聞</title>")
Response.Write(
"<link>http://www.8848so.com</link>")
Response.Write(
"<description>8848so.com 百科存儲</description>")
Response.Write(
"<category>8848so</category>")
Response.Write(
"<language>zh-cn</language>")
Response.Write(
"<docs>http://www.8848so.com/RSS/RSS.asp</docs>")
Response.Write(
"<generator>www.8848so.com</generator>")
Response.Write(
"<webMaster>[email protected]</webMaster>")
Response.Write(
"<managingEditor>[email protected]</managingEditor>")
Response.Write(
"<pubDate>"&Now()&"</pubDate>")
Response.Write(
"<lastBuildDate>"&Now()&"</lastBuildDate>")
Response.Write(
"<ttl>30</ttl> ")
Response.Write(
"<copyright>Copyright 2007,8848So.</copyright>")

Do While (rs.Eof = False)
    
    Response.Write(
"<item>")
    Response.Write(
"<guid>"&rs("ID")&"</guid>")        
    Response.Write(
"<title>"&rs("Title")&"</title>")
    Response.Write(
"<link>"&rs("Link")&"</link>")
    Response.Write(
"<description><![CDATA["&rs("Content")&"]]></description>")
    Response.Write(
"<author>"&rs("AddRealName")&"</author>")
    Response.Write(
"<source>8848So</source>")
    Response.Write(
"<category>8848So.com 人物新聞</category>")
    Response.Write(
"<pubDate>"&rs("NewsDT")&"</pubDate>")    
    Response.Write(
"<comments>8848So.com 人物新聞</comments>")    
    Response.Write(
"</item>")
    
    rs.MoveNext()
Loop

Response.Write(
"</channel>")
Response.Write(
"</rss>")

Call CDB()
%
>
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章