• RSS PUBData 把正常时间函数转成rss2.0的标准


    <% @language="VBScript"%>

    <%
    Function return_RFC822_Date(byVal myDate,byVal TimeZone)
      Dim myDay, myDays, myMonth, myYear
      Dim myHours, myMinutes, mySeconds
      
      'myDate = CDate(myDate)
      myDay = EnWeekDayName(myDate)
      myDays = Right("00" & Day(myDate),2)
      myMonth = EnMonthName(myDate)
      myYear = Year(myDate)
      myHours = Right("00" & Hour(myDate),2)
      myMinutes = Right("00" & Minute(myDate),2)
      mySeconds = Right("00" & Second(myDate),2)
        return_RFC822_Date = myDay&", "& _
      myDays&" "& _
      myMonth&" "& _
      myYear&" "& _
      myHours&":"& _
      myMinutes&":"& _
      mySeconds&" "& _
      " " & TimeZone
    End Function

    Function EnWeekDayName(InputDate)
     Dim Result
     Select Case WeekDay(InputDate,1)
     Case 1:Result="Sun"
     Case 2:Result="Mon"
     Case 3:Result="Tue"
     Case 4:Result="Wed"
     Case 5:Result="Thu"
     Case 6:Result="Fri"
     Case 7:Result="Sat"
     End Select
     EnWeekDayName = Result
    End Function

    Function EnMonthName(InputDate)
     Dim Result
     Select Case Month(InputDate)
     Case 1:Result="Jan"
     Case 2:Result="Feb"
     Case 3:Result="Mar"
     Case 4:Result="Apr"
     Case 5:Result="May"
     Case 6:Result="Jun"
     Case 7:Result="Jul"
     Case 8:Result="Aug"
     Case 9:Result="Sep"
     Case 10:Result="Oct"
     Case 11:Result="Nov"
     Case 12:Result="Dec"
     End Select
     EnMonthName = Result
    End Function
    '*************************************以上是时间转换的函数************************88
    Function readrss(xmlseed,my_line)
    dim xmlDoc
    dim http
    Set http=Server.CreateObject("Microsoft.XMLHTTP")
    http.Open "GET",xmlseed,False
    http.send
    Set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")
    xmlDoc.Async=False
    xmlDoc.ValidateOnParse=False
    xmlDoc.Load(http.ResponseXML)
    Set item=xmlDoc.getElementsByTagName("item")
    number=item.length   '得到所得取的RSS页中一共有多少项
      if item.Length<=10 then
    %>
    <script language="JavaScript">
    //alert("对不起,该新闻条数已经少于10条新闻条数!");
    </script>
    <%
    else
    For i=0 To (item.Length-1)
    Set title=item.Item(i).getElementsByTagName("title")
    Set link=item.Item(i).getElementsByTagName("link")
    set pubDate=item.item(i).getElementsByTagName("pubDate")
    Response.Write("<a href="""& link.Item(0).Text &""" target='_blank'>"& title.Item(0).Text &"</a>"&  return_RFC822_Date(Now(),"")   &"<br>")
    Next
    end if
    End Function
    %>
    <html>
    <head>
    <title>远程读取XML文件</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
    <body>
    <%
    call readrss("http://rss.sina.com.cn/news/allnews/tech.xml",10)
    %>
    <br><br>
    <%
    call readrss("http://rss.sina.com.cn/news/allnews/astro.xml",10)
    %>
    </body>
    </html>

  • 相关阅读:
    Centos安装Memcached和(Nginx)Memcache扩展详细教程
    文章已被删除!
    phonegap安卓手机开发入门
    微信分享链接带图片文字和描述
    CSDN数据库被爆 统计CSDN用户都喜欢哪些密码
    ...
    重新初始化 VS2010
    spark系列之基本概念
    python 数字字典加密非汉字
    MySQL 5.7实现 row_number窗口函数
  • 原文地址:https://www.cnblogs.com/winner/p/592303.html
Copyright © 2020-2023  润新知