How to use the RSS Feed??

th3Phallex

Newbie
Joined
Dec 1, 2004
Messages
131
Reaction score
0
I am trying to use the news feed that is supplied by this site.

First, I have an ASP page that does this:
PHP:
<%
' define the variables
dim objHTTP , objXML , objXSL
'create an instance of the xmlHTTP object
set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")
' get the requested XML data from website
objHTTP.open "GET", "http://www.halflife2.net/forums/external.php?type=rss&forumids=32", false
objHTTP.send
' save the XML in the objXML object as XML
set objXML = objHTTP.responseXML
'create an instance of the DOM obdct
set objXSL=Server.CreateObject("microsoft.xmldom")
objXSL.async=false
' load the XSL style sheet into the objXSL object
objXSL.load(Server.MapPath("hl2net.xsl"))
' check for errors in the XSL
if (objXSL.parseError.errorCode = 0) then
' parse the XML with the XSL file
Response.Write(objXML.transformnode(objXSL))
else
'if an error occurs, report it
Response.Write "Error: " & objXSL.parseError.reason & "[br] URL:" & objXSL.url
end if
'destroy the objects
Set objHTTP = Nothing
Set objXML = Nothing
Set objXSL = Nothing
%>

Also, I have an .XSL page that is doing this:
PHP:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
    <xsl:template match="/">

<HTML>
<HEAD>
<TITLE>RSS Test</TITLE>
</HEAD>
<BODY BGCOLOR="ffffff">
<DIV ALIGN="center">
<TABLE BGCOLOR="ffffff"  CELLPADDING="4" CELLSPACING="0" >

      <xsl:for-each select="channel/item">
        <xsl:choose>
           <xsl:when expr="childNumber(this) > 5"></xsl:when>
           <xsl:otherwise>
	     <TR VALIGN="middle">
	       <TD ALIGN="left" BGCOLOR="ffffff">
	         [b]
                   <A>
		     <xsl:attribute name="HREF">
		       <xsl:value-of select="link"/>
		     </xsl:attribute>
		     <xsl:attribute name="TARGET">
		       _blank
		     </xsl:attribute>
		     <FONT  SIZE="1" COLOR="000000">
		       <xsl:value-of select="title"/>
		     </FONT>
		   [/url]
		 [/b]
	       </TD>
	     </TR>
           </xsl:otherwise>
         </xsl:choose>
       </xsl:for-each>

</TABLE>
</DIV>
</BODY>
</HTML>
    </xsl:template>
  </xsl:stylesheet>

I have made it work using the SteamPowered.com RSS feed, but it won't work with this site. I've changed all the variables to be the correct names (title, description, link, etc...) and it still won't even get anything to show.

The STEAM feed is an .XML file, whereas the feed from HL2.net is a link:
http://www.halflife2.net/forums/external.php?type=rss&forumids=32.

I also noticed that this site has a PHP page that generates the XML. Does this matter?

Pleeeeeez help!
 
theGreenBunny said:
Have you tried manually copying the http://www.halflife2.net/forums/external.php?type=rss&forumids=32 page into a .xml file, uploading it to your webspace and linking to the file instead of the hl2.net php? If it still doesn't work it's probably a parsing issue.

I'd go into more detail but I've never used xml myself.


Whoah!
That's exactly what I did.

But yeah, what about this "parsing" dealy-thing??

Have you seen a work-around for it?

Thanks!
 
There aren't any problems with the feed, it works fine here - I don't know enough asp to tell what's wrong in your code though. I don't think it's just the names of the fields, more likely the nestings of tags that you're missing.

I can parse it properly in php, so it's not a problem with the feed itself.

Regarding it being .xml, that shouldn't be a problem as I assume the page is sent with content type text/xml in the headers.
 
StarMonkey said:
There aren't any problems with the feed, it works fine here - I don't know enough asp to tell what's wrong in your code though. I don't think it's just the names of the fields, more likely the nestings of tags that you're missing.

I can parse it properly in php, so it's not a problem with the feed itself.

Regarding it being .xml, that shouldn't be a problem as I assume the page is sent with content type text/xml in the headers.

Ok,

Thanks for the info!

I guess I'll have to do more troubleshooting on it and search through Google...
 
OK, so I forgot the "rss" part.

In the "< xsl:for-each select=" part, I needed to add "rss" so it would read "< xsl:for-each select=rss/channel/item>".


But now, instead of displaying the actual description, it just displays the [CDATA] part, un-formatted.
ex:

Steam Update
Forum: News &amp;amp; Announcements Posted By: KagePrototype Post Time: 10-01-2005 at 11:40 PM


What does the PHP code look like to display the correct description?? Maybe I can find something that will do the same in ASP??

Thanks!
 
Hey I never understood what rss feed was exactly, can someone here explain.
 
Grey Fox said:
Hey I never understood what rss feed was exactly, can someone here explain.

RSS is a Web content syndication format.

Its name is an acronym for Really Simple Syndication.

RSS is a dialect of XML. All RSS files must conform to the XML 1.0 specification, as published on the World Wide Web Consortium website.
 
Kyo said:
RSS is a Web content syndication format.

Its name is an acronym for Really Simple Syndication.

RSS is a dialect of XML. All RSS files must conform to the XML 1.0 specification, as published on the World Wide Web Consortium website.
Translated:

Using our RSS feed on an RSS program (such as the one built into Firefox or RSSBandit) will notify you as soon as there are updates on the news page.
 
Chris_D said:
Using our RSS feed on an RSS program (such as the one built into Firefox or RSSBandit) will notify you as soon as there are updates on the news page.


That was my problem.


No one explained that I had to use a separate program to parse the XML data. That's why everything in the "description" tag won't show up.


Thanks for clearing that up!
 
I'm still having troubles getting the data to show up, when I use this site's RSS feed.

Here's a screenshot of the XML page.
Notice how in the < description> tag, there is nothing but info about when that story was posted, so that is the only info that gets pulled into my ASP script. There is NO HTML-formatted content, like there usually is (in EVERY OTHER RSS FEED).

Has anyone found a way to get the actual data into those < description> tags?? Or better yet, has anyone been able to use this with regular ASP (not .NET)?
 
Yeah, it's not the best RSS feed in the world. It's automatically generated by vBulletin though, it's not like we've written it ourselves.
 
Chris_D said:
Yeah, it's not the best RSS feed in the world. It's automatically generated by vBulletin though, it's not like we've written it ourselves.

Oh, ok.

That's what I was thinking -- I've seen stuff on Google about a "RSS News Hack for vBulletin"...

I guess I'll look around some more.

Thanks!


.:edit:.
I tried using RSS Bandit, but it also just showed the same info, and not the actual content.

So I guess RSS Bandit doesn't help either.

hmm...
 
Back
Top