Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Best way to get multiple news feeds
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Hamlin
Advanced Member

United Kingdom
2386 Posts

Posted - 07 April 2002 :  10:49:15  Show Profile
Hi i use this code to get news feeds to my site

<%
' this function takes two strings as an input and counts
' how many occurrences of string 2 are found in string 1
' It counts how many headlines are available, if you are
' using an organised category rather than a custom one you
' could delete this function.
Function CountOccurances(strOne, strTwo)

Dim intCount, intCursor
Do
intCursor = InStr(intCursor + 1, strOne,strTwo)
If intCursor > 0 Then
intCount = intCount + 1
End If
Loop While intCursor > 0
CountOccurances = intCount
End Function

' define the variables
dim objHTTP
dim objXML
dim objXSL

' set-up XMLHTTP

set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")

' get the requested XML data from the remote location
' change the URL as per your feed.
objHTTP.open "GET", "http://p.moreover.com/cgi-local/page?c=Offbeat%20news&o=xml", false
objHTTP.send

' save the XML in objXML as XML
set objXML = objHTTP.responseXML

' set-up XMLDOM
set wdobjXSL=Server.CreateObject("microsoft.xmldom")
objXSL.async=false

' load the XSL style sheet into the objXSL object
' change file name to match your XSL file
objXSL.load(Server.MapPath("csstyle.xsl"))

' check for errors in the XSL
if (objXSL.readyState = 4 AND objXSL.parseError.errorCode = 0) then

' check how many headlines there are by counting the TR tags
' delete this line if not using function, CountOccurances.
HowMany = CountOccurances(objXML.transformnode(objXSL), "<TR>")

' delete the next three lines if not using function, CountOccurances.
if (isnull(HowMany) or (HowMany ="")) then
Response.Write "Sorry, no headlines available at present!"
else
' if everything is alright parse the XML with our XSL
Response.Write(objXML.transformnode(objXSL))
' delete the next line if not using function, CountOccurances.
end if
else
'if an error occurs, report it
Response.Write "Error: " & objXSL.parseError.reason & "<br> URL:" & objXSL.url
end if
%>


can any one suggest an easy way to use lots of different news feeds, i'm not sure how to go about it.

any help appreciated

  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.16 seconds. Powered By: Snitz Forums 2000 Version 3.4.07