Microsoft.XMLDOM - Facebook Page RSS - System error: -2147012866

650 views Asked by At

I had successfully hooked up my Classic ASP site to read a Facebook page RSS feed and return details on the latest post. This had been working perfectly fine when set up, but I noticed the other day that it no longer worked. I've fiddled with it quite a bit, but nothing I do seems to make a difference, and so far I've had no luck finding anyone else that has had this issue.

My code looks like this:

    dim TheFeed, objXML, objRoot, objItems, TheTitle, TheLink, objItem, TheDate, TheContent

    TheFeed = "https://www.facebook.com/feeds/page.php?format=rss20&id=1472957232934372"

    Set objXML = Server.CreateObject("Microsoft.XMLDOM")

    objXML.Async = False
    objXML.SetProperty "ServerHTTPRequest", True
    objXML.SetProperty "SelectionLanguage", "XPath"
    objXML.ResolveExternals = True
    objXML.ValidateOnParse = True
    objXML.Load(TheFeed)

    If (objXML.parseError.errorCode = 0) Then
       Set objRoot = objXML.documentElement
       If IsObject(objRoot) = False Then
           Response.Write "There was an error retrieving the feed"
       Else
           Set objItems = objXML.selectNodes("//item[position() <= 1]")
              If IsObject(objItems) = True Then
                  For Each objItem in objItems
                      On Error Resume Next
                      TheTitle =  objItem.selectSingleNode("title").Text
                      TheLink =  replace(objItem.selectSingleNode("link").Text,"&","&amp;")
                      TheDate =  left(objItem.selectSingleNode("pubDate").Text,16)
                      TheContent =  objItem.selectSingleNode("description").Text 
                Next
             End If
         Set objItems = Nothing
       End If
    Else
        Response.Write "There was an error retrieving the blog: " & objXML.parseError.reason
    End If
    Set objXML = Nothing

The result it produces:

There was an error retrieving the blog: System error: -2147012866.

Has anyone else had any issues with trying to read the Facebook RSS feeds recently? Does anyone know what may be the issue here? Any help would be greatly appreciated!

1

There are 1 answers

1
John On BEST ANSWER

Try using the latest version of Microsoft's XML processor. Replace your third line of code with:

Set objXML = Server.CreateObject("Msxml2.DomDocument.6.0")

I notice you don't appear to be outputting your XML node values, your just writing them to variables. If you're looping through a set of elements then the values of TheTitle, TheLink, TheDate and TheContent will be overwritten with each iteration, and if you response.write them later in your page you will only display the last record to be parsed