Jump to content

Archived

This topic is now archived and is closed to further replies.

Vinze

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

Recommended Posts

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.

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

Share this post


Link to post
Share on other sites
You could check the user agent with $_SERVER['HTTP_USER_AGENT']

Share this post


Link to post
Share on other sites
[quote author=SemiApocalyptic link=topic=102457.msg406778#msg406778 date=1154380587]
You could check the user agent with $_SERVER['HTTP_USER_AGENT']
[/quote]

But why should user agent be different, I mean, the program used to access the page is still the same..

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.