Jump to content


Photo

Checking whether an RSS feed is read by or visited in the browser


  • Please log in to reply
4 replies to this topic

#1 Vinze

Vinze
  • Members
  • PipPipPip
  • Advanced Member
  • 80 posts

Posted 31 July 2006 - 04:54 PM

Hey, I got a page with an RSS feed generated by PHP. However, I want the page to show the contents of the feed when just visited in the browser, formatted as HTML. To do this, I need to be able to differentiate between the page being read as an RSS feed or being shown in the browser. Any ideas on how to do that?

Thanks in advance.

$_SERVER['HTTP_USER_AGENT'] does not work, as the RSS feed might be read by Firefox or another browser with RSS capabilities.


WTH? I became a guru by asking questions!

#2 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 31 July 2006 - 09:16 PM

You could check the user agent with $_SERVER['HTTP_USER_AGENT']

#3 Vinze

Vinze
  • Members
  • PipPipPip
  • Advanced Member
  • 80 posts

Posted 01 August 2006 - 08:12 AM

You could check the user agent with $_SERVER['HTTP_USER_AGENT']


But why should user agent be different, I mean, the program used to access the page is still the same..
WTH? I became a guru by asking questions!

#4 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 01 August 2006 - 08:35 AM

Sorry, I think I must have misunderstood you. I thought the feed would either be viewed with a browser, or with an RSS aggregator, and the feed would be formatted differently depending on what it was being viewed in. My bad.

#5 Vinze

Vinze
  • Members
  • PipPipPip
  • Advanced Member
  • 80 posts

Posted 01 August 2006 - 08:37 AM

Oh yes of course, RSS aggregator is also possible, but as Firefox has Live bookmarks and RSS extensions $_SERVER['HTTP_USER_AGENT'] would be of no use.
WTH? I became a guru by asking questions!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users