Hi,
I've got a function which parses RSS feeds into HTML via some ASP processing:
Sometimes this works perfectly, but most of the time I get an error:Code:function getRSSFeed(strRSSFeedURL, strSource_In) ' ##### URL to RSS Feed to display ######### URLToRSS = strRSSFeedURL ' ##### max number of displayed items ##### MaxNumberOfItems = 1 ' ##### Main template constants MainTemplateHeader = "" MainTemplateFooter = "" ' ##### ' ##### Item template. ' ##### {LINK} will be replaced with item link ' ##### {TITLE} will be replaced with item title ' ##### {DESCRIPTION} will be replaced with item description ItemTemplate = "<h2><a href=" & """{LINK}""" & " target=""_blank"">{TITLE}</a></h2><p class=""source""><strong>Source:</strong> " & strSource_In & "</p><p><a href=" & """{LINK}""" & " target=""_blank"">{DESCRIPTION}</a></p>" ' ##### Error message that will be displayed if not items etc ErrorMessage = "Error has occured while trying to process " &URLToRSS & "<BR>Please contact web-master" ' ================================================ Set xmlHttp = Server.CreateObject("MSXML2.XMLHTTP.3.0") xmlHttp.Open "Get", URLToRSS, false xmlHttp.Send() RSSXML = xmlHttp.ResponseText Set xmlDOM = Server.CreateObject("MSXML2.DomDocument.3.0") xmlDOM.async = false xmlDOM.LoadXml(RSSXML) Set xmlHttp = Nothing ' clear HTTP object Set RSSItems = xmlDOM.getElementsByTagName("item") ' collect all "items" from downloaded RSS Set xmlDOM = Nothing ' clear XML RSSItemsCount = RSSItems.Length-1 j = -1 For i = 0 To RSSItemsCount Set RSSItem = RSSItems.Item(i) for each child in RSSItem.childNodes Select case lcase(child.nodeName) case "title" RSStitle = child.text case "link" RSSlink = child.text case "description" RSSdescription = child.text End Select next j = J+1 RSSdescription = WholeWords(RSSdescription,80) if J<MaxNumberOfItems then ItemContent = Replace(ItemTemplate,"{LINK}",RSSlink) ItemContent = Replace(ItemContent,"{TITLE}",RSSTitle) Response.Write Replace(ItemContent,"{DESCRIPTION}",RSSDescription) ItemContent = "" End if Next 'Response.End ' uncomment this line if you need to finalize output end function
Can anyone see why this might be happening, and more importantly how to get it working properly all the time?Code:Microsoft VBScript runtime error '800a01fb' An exception occurred: 'xmlHttp.Send' news.asp, line 51
Thanks very much...





Bookmarks