Foros del Web » Programando para Internet » ASP Clásico »

lector rss en asp error

Estas en el tema de lector rss en asp error en el foro de ASP Clásico en Foros del Web. hola tengo este script Código PHP: <%      ' change the RSSURL variable to the exact URL of the RSS Feed you want to pull     RSSURL = "http://twitter.com/statuses/user_timeline/78665678.rss"          Dim objHTTP '  this object is used to call the RSS Feed remotely     Dim RSSURL , RSSFeed  ' these variables hold the URL and Content for the RSS Feed     Dim xmlRSSFeed '  this variable hold the XML data in a DOM Object     Dim objItems , objItem ,  objChild  ' these variables are used to temporarily hold data from the various RSS Items ...
  #1 (permalink)  
Antiguo 23/05/2011, 18:05
Avatar de engonga
Usuario no validado
 
Fecha de Ingreso: marzo-2002
Ubicación: Buenos Aires
Mensajes: 1.300
Antigüedad: 22 años, 1 mes
Puntos: 8
lector rss en asp error

hola tengo este script

Código PHP:

<%
    
' change the RSSURL variable to the exact URL of the RSS Feed you want to pull
    RSSURL = "http://twitter.com/statuses/user_timeline/78665678.rss"
    

    Dim objHTTP ' 
this object is used to call the RSS Feed remotely
    Dim RSSURL
,RSSFeed ' these variables hold the URL and Content for the RSS Feed
    Dim xmlRSSFeed ' 
this variable hold the XML data in a DOM Object
    Dim objItems
,objItemobjChild ' these variables are used to temporarily hold data from the various RSS Items
    Dim title,description,link '  
these are local variables that will hold the data to be displayed
    Dim OutputHTML_1
,OutputHTML_2,OutputHTML_3 ' these variables will hold the HTML that was converted from the RSS Feed

    ' 
this code requests the raw RSS/XML and saves the response as a string <RSSFeed>
    
Set objHTTP Server.CreateObject("Msxml2.ServerXMLHTTP")
    
objHTTP.open "GET",RSSURL,false
    objHTTP
.send
    RSSFeed 
objHTTP.responseText

    
' this code takes the raw RSSFeed and loads it into an XML Object
    '
Set xmlRSSFeed Server.CreateObject("MSXML2.DomDocument.4.0")
    
Set xmlRSSFeed Server.CreateObject("MSXML2.DOMDocument.3.0")
    
xmlRSSFeed.async false
    xmlRSSFeed
.LoadXml(RSSFeed)

    
' this code disposes of the object we called the feed with
    Set objHTTP = Nothing

    ' 
this is where you determine how to display the content from the RSS Feed

    
' this code grabs all the "items" in the RSS Feed
    Set objItems = xmlRSSFeed.getElementsByTagName("item")

    ' 
this code disposes of the XML object that contained the entire feed
    Set xmlRSSFeed 
Nothing

    
' loop over all the items in the RSS Feed
    '
For 0 to objItems.length 1
    
For 0 to 2
        
' this code places the content from the various RSS nodes into local variables
        Set objItem = objItems.item(x)
        For Each objChild in objItem.childNodes
            Select Case LCase(objChild.nodeName)
                Case "title"
                      title = objChild.text
                Case "link"
                      link = objChild.text
                Case "description"
                      description = objChild.text
            End Select
        Next
        ' 
Here are some various display samples.
        
OutputHTML_1 OutputHTML_1 "<a href=""" link """>" title "</a><br />" description "<br /><br />"
        'OutputHTML_1 = Server.HTMLEncode( OutputHTML_1 ) 
        
        OutputHTML_2 = OutputHTML_2 & "<a href=""" & link & """ target=""_blank""  class=""blocmes"" style=""padding: 0px 5px 0px 0px;"">@" & title & "</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
        '
OutputHTML_2 Server.HTMLEncodeOutputHTML_2 )
        
        
        
OutputHTML_3 OutputHTML_3 "<a href=""" link """>" title "</a><hr />"
        
OutputHTML_3 Server.HTMLEncodeOutputHTML_3 )
    
Next

%> 
el problema es que si el servidor que me sirve el rss noe sta disponible el script me da un error... existe una posiblidad de ponerle algun detector de error del sevidor y que muestre que no se pueden mostrar los datos?
  #2 (permalink)  
Antiguo 24/05/2011, 09:09
Avatar de Javier01  
Fecha de Ingreso: febrero-2008
Ubicación: Montevideo
Mensajes: 261
Antigüedad: 16 años, 2 meses
Puntos: 31
Respuesta: lector rss en asp error

Sacado de http://xstandard.com/en/documentation/xhttp/


This example shows how to check the status of a Web siteAn HTTP response code
number 200 means the Web server sends data back OK.

Código ASP:
Ver original
  1. Dim objHTTPSet
  2. objHTTP = Server.CreateObject("XStandard.HTTP")
  3. objHTTP.AddRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MyApp 1.0; Windows NT 5.1)"
  4. objHTTP.Get "http://xstandard.com"
  5. If objHTTP.ResponseCode = 200 Then
  6.     Response.Write "Web site is up and running!"
  7. Else
  8.     Response.Write "Web site is down!!!"
  9. End If
  10. Set objHTTP = Nothing
  #3 (permalink)  
Antiguo 18/01/2012, 06:07
 
Fecha de Ingreso: enero-2012
Mensajes: 19
Antigüedad: 12 años, 3 meses
Puntos: 0
Mensaje Respuesta: lector rss en asp error

Gracias. Está solucionado.

Última edición por Imasnet; 08/03/2012 a las 02:01 Razón: Duda solucionada.

Etiquetas: asp, lector, rss
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:53.