HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old November 5th, 2009, 04:59 AM
apachehelp apachehelp is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2008
Posts: 38 apachehelp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 32 m 20 sec
Reputation Power: 2
RSS help please

I have the BBC news feed on my site, however, the BBC website went down today, therefore sending my website down because the operating had timed out.

Is there any code I can use which will allow me to redirect the user to another page if the operation has timed out?

This is the bit of code I think it must go with.

Code:
Set xmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
xmlHttp.Open "GET", URLToRSS, false
xmlHttp.Send()
RSSXML = xmlHttp.ResponseText


Thanks

Reply With Quote
  #2  
Old November 5th, 2009, 05:10 AM
marco_v marco_v is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2009
Posts: 89 marco_v User rank is Sergeant (500 - 2000 Reputation Level)marco_v User rank is Sergeant (500 - 2000 Reputation Level)marco_v User rank is Sergeant (500 - 2000 Reputation Level)marco_v User rank is Sergeant (500 - 2000 Reputation Level)marco_v User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 3 h 6 m 27 sec
Reputation Power: 19
I do somethign similar on a site i look after, i pull in the companies twitter feed (xml) and displayit all.

and on ocasions the twitter feed has gone causing the page to go down.

my page works differently to yours but what i do is this:-

Code:
objXML.Load ("link to rss feed")
isValid = cBool(objXML.parseError.errorCode = 0)
	
if isValid then
        do what ever i need to do because its valid
else
        do something because it cant load anything
end if


that basically trys to load the rss/xml feed and if it cant say because its down or there is a problem it will exicute another piece of code, in your case a call to take the person to a different page.

hope this helps

Reply With Quote
  #3  
Old November 5th, 2009, 05:19 AM
apachehelp apachehelp is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2008
Posts: 38 apachehelp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 32 m 20 sec
Reputation Power: 2
Code:
<%
URLToRSS = "http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/health/rss.xml"
MaxNumberOfItems = 5
'MainTemplateHeader = "<table>"
'MainTemplateFooter = "</table>"

Keyword1 = "" 
Keyword2 = "" 

ItemTemplate = "<a href=" & """{LINK} """ & " TARGET='_blank' class='individualsfamileslink'>{TITLE}:</a>&nbsp; {DESCRIPTION} &nbsp; &nbsp; "

ErrorMessage = "Error has occured while trying to process " &URLToRSS & "<BR>Please contact web-master"

Set xmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
'''''''''''''''''xmlhttp.setTimeouts 5000, 60000, 10000, 20000 
xmlHttp.Open "GET", URLToRSS, false
xmlHttp.Send()
RSSXML = xmlHttp.ResponseText

Set xmlDOM = Server.CreateObject("MSXML2.DomDocument.3.0")
xmlDOM.async = False
xmlDOM.validateOnParse = False
xmlDom.resolveExternals = False

If not xmlDOM.LoadXml(RSSXML) Then
ErrorMessage = "Can not load XML:" & vbCRLF & xmlDOM.parseError.reason & vbCRLF & ErrorMessage

End If

Set xmlHttp = Nothing 

Set RSSItems = xmlDOM.getElementsByTagName("item") 

RSSItemsCount = RSSItems.Length-1

if RSSItemsCount = -1 Then
Set RSSItems = xmlDOM.getElementsByTagName("entry") 
RSSItemsCount = RSSItems.Length-1

End If

Set xmlDOM = Nothing 

if RSSItemsCount > 0 then
Response.Write MainTemplateHeader
End If

j = -1

For i = 0 To RSSItemsCount
Set RSSItem = RSSItems.Item(i)'

RSSdescription="&nbsp;" 
RSSCommentsLink="&nbsp;"

for each child in RSSItem.childNodes

Select case lcase(child.nodeName)
case "title"
RSStitle = child.text
case "link"
If child.Attributes.length>0 Then
RSSLink = child.GetAttribute("href")
if (RSSLink <> "") Then
if child.GetAttribute("rel") <> "alternate" Then
RSSLink = ""
End If
End If
End If ' if has attributes
If RSSLink = "" Then
RSSlink = child.text
End If
case "description"
RSSdescription = child.text
case "content" ' atom format
RSSdescription = child.text
case "published"' atom format
RSSDate = child.text
case "pubdate"
RSSDate = child.text
case "comments"
RSSCommentsLink = child.text
case "category"
Set CategoryItems = RSSItem.getElementsByTagName("category")
RSSCategory = ""
for each categoryitem in CategoryItems
if RSSCategory <> "" Then
RSSCategory = RSSCategory & ", "
End If

RSSCategory = RSSCategory & categoryitem.text
Next
End Select
next

 'now check filter
If (InStr(RSSTitle,Keyword1)>0) or (InStr(RSSTitle,Keyword2)>0) or (InStr(RSSDescription,Keyword1)>0) or (InStr(RSSDescription,Keyword2)>0) then

j = J+1

if J<MaxNumberOfItems then
ItemContent = Replace(ItemTemplate,"{LINK}",RSSlink)
ItemContent = Replace(ItemContent,"{TITLE}",RSSTitle)
ItemContent = Replace(ItemContent,"{DATE}",RSSDate)
ItemContent = Replace(ItemContent,"{COMMENTSLINK}",RSSCommentsLink)
ItemContent = Replace(ItemContent,"{CATEGORY}",RSSCategory)

Response.Write Replace(ItemContent,"{DESCRIPTION}",RSSDescription)
ItemContent = ""
RSSLink = ""
End if
End If

Next

if RSSItemsCount > 0 then
Response.Write MainTemplateFooter
else
Response.Write ErrorMessage
End If 

%>


Thanks for that, that looks good, however I'm not sure how I would implement that into my code

Reply With Quote
  #4  
Old November 5th, 2009, 05:29 AM
marco_v marco_v is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2009
Posts: 89 marco_v User rank is Sergeant (500 - 2000 Reputation Level)marco_v User rank is Sergeant (500 - 2000 Reputation Level)marco_v User rank is Sergeant (500 - 2000 Reputation Level)marco_v User rank is Sergeant (500 - 2000 Reputation Level)marco_v User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 3 h 6 m 27 sec
Reputation Power: 19
like i said you are doing this a completely different way to how i would do it but to make my way work you woudl add this at thte top fo your page

Code:
URLToRSS = "http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/health/rss.xml"
dim	objXML
Set objXML = Server.CreateObject("Microsoft.XMLDOM")
objXML.Load ("http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/health/rss.xml")
isValid = cBool(objXML.parseError.errorCode = 0)

if isValid then


then at the bottom of your code add this

Code:
else
      what ever you want the script to do because an error was found
end if


not the best way to do it, but like i said ive never used the method your currently using so im a little lost

Reply With Quote
  #5  
Old November 7th, 2009, 01:57 AM
Labhrainn Aemi Labhrainn Aemi is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2009
Posts: 1 Labhrainn Aemi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 m 55 sec
Reputation Power: 0
RSS help please

RSS feeds are usually just the headline scrolling across some sort of RSS News Viewer. However, depending on the viewer, you might have a link to click to read more information. Many weblogs make content available in RSS. A news aggregator can help you keep up with all your favorite weblogs by checking their RSS feeds and displaying new items from each of them.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > RSS help please


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek