PDA

View Full Version : AS3 RSS feed working locally but not online



rohan
December 25th, 2009, 04:40 AM
Hi all,

got a weird problem. I've got an RSS feed coming into my flash site. When I test this locally its all good, everything works fine, I can see the RSS feed and everything.

But now when I test online, I can't see any RSS, nothing. Its just blank. Any idea why this might happen?

I have no idea how to error check this either..

wvxvw
December 25th, 2009, 08:46 AM
Probably the domain that provides the feed doesn't provide a permitting crossdomain policy file. If this is the case, and the domain owners won't provide such feature, there is nothing you can do about it, unless you put your server-side script to proxy the request from your flash app to the domain in question. (It may be also possible to do that with JavaScrip, however, JavaScript has it's own security issues).

rohan
December 25th, 2009, 08:49 AM
Hi wvxvw, thanks for the reply. Yeah I think its a cross domain issue BUT, the weird thing is, its a feedburner feed, and I know they allow crossdomain.xml access. I know my code works in a local environment, on my PC it works, and also, I uploaded a test of the site to my own personal blog, and tested its feed url, and that also works.

Really frustrating I can't understand why it works locally but not in a cross domain situation

wvxvw
December 25th, 2009, 02:35 PM
Can you show what their crossdomain looks like? (It should be served from http://rss-feed-name.com/crossdomain.xml)

rohan
December 25th, 2009, 07:20 PM
Hi wvxvw, their crossdomain looks like this:

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>

and its here:

http://feeds.feedburner.com/crossdomain.xml

I did another test as well...my client has a company blog, which of course has a feed. This feed is the one which Feedburner is using. He wants the Feedburner feed to be displayed in Flash (I guess so clicks get recorded or something). But if I try it with the path to the blog's feed (http://www.theblog.com/feed for example) it works, offline and online.

So it seems to me that the problem could be Feedburner...I'm not sure why though, I wonder if anyone else has had this issue with accessing their feeds through Flash.

rohan
December 25th, 2009, 07:25 PM
Hi wvxvw, their crossdomain looks like this:

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>

and its here:

http://feeds.feedburner.com/crossdomain.xml

I did another test as well...my client has a company blog, which of course has a feed. This feed is the one which Feedburner is using. He wants the Feedburner feed to be displayed in Flash (I guess so clicks get recorded or something). But if I try it with the path to the blog's feed (http://www.theblog.com/feed for example) it works, offline and online.

So it seems to me that the problem could be Feedburner...I'm not sure why though, I wonder if anyone else has had this issue with accessing their feeds through Flash.

But then again...I've even tried using a proxy url with a php script and even that doesn't work, eventhough if I access the proxy url through my browser, it goes directly to the feedburner feed.

Really stumped on this one...

Thanks again for your help!

wvxvw
December 25th, 2009, 07:52 PM
Well, it seems like their server sends wrong headers with the crossdomain.xml... for me it offers to save the XML file instead of opening it in the browser... Maybe that's why...

rohan
December 25th, 2009, 07:54 PM
yeah...I thought that was interesting too...do you think that could be the problem?

wvxvw
December 25th, 2009, 07:56 PM
Definitely... I think that if you're familiar with the site owners, you might tell them that's the case with the XML, because for now it's sort of useless to have it there anyway...

rohan
December 25th, 2009, 08:02 PM
One thing though, why would it work locally if the headers were incorrect? Wouldn't it be broken there also?

rohan
December 25th, 2009, 08:05 PM
Ahh, maybe its not trying to use the crossdomain.xml when Flash tries to access the feed locally? But still...even if there was a cross domain issue, wouldn't a PHP proxy be the ultimate solution to this? Is there perhaps some point in my code where things could be going wrong? Its so difficult to error check this. It seems some people have had a similar issue, but I can't find a complete answer...

My list of issues is


Locally testing feeds works, no matter where they come from, Feedburner or the blog's direct feed work perfectly
Online testing fails for feedburner but succeeds when accessing the blog's direct feed
Proxy script does not work for the feedburner feed online


So, at first it seems the issue must be something to do with Feedburner...but then why does it work locally? Perhaps the case is that


When accessing the Feedburner feed locally, there is no need for Feedburner's crossdomain.xml file
when accessing the Feedburner feed online, the crossdomain.xml file is needed, but its headers are incorrect causing the feed connection to fail


:jail:

wvxvw
December 25th, 2009, 09:15 PM
yep, that's true, when you test locally crossdomain doesn't matter, it will load even if no crossdomain is present or crossdomain doesn't permit the access. I'm not sure about the PHP proxy... maybe try showing the code?
Anyways, what I'm thinking is that the RSS server may be expecting some particular headers in request usually sent by browsers (aka User Agents), to distinguish that from crawlers. I know about couple of servers that do it - WoW knowledge base is one of them for example. Try printing out what you get in response when trying to retrieve the RSS content with PHP and what you are getting when accessing that from browser (use HTTPFox or Charles to see the request-response full content - this would definitely clarify things).

rohan
December 27th, 2009, 07:50 AM
hey got an update on this.

I switched to accessing the blog's direct feed instead, and this worked.

I personally think the problem lies with images (yes the client needs these to be displayed in the feed on the flash site). Let's say I'm accessing the feedburner feed. Well that feed, is getting images from the original blog, and also getting the text, but the text is written out, and is being served from Feedburner (I think), while the images are being served from the blog.

So in essence, isn't Flash trying to access 2 places at once? The feedburner domain and the blog's domain?

I've noticed that as soon as there are images, and they're located somewhere other than the blog's domain, they simply don't show up.

Has anyone else noticed this issue at all? I see a lot of people parsing RSS feeds in flash, but not that many trying it with images as well. Even proxy URLing is not working for images. The only way I can get images to work actually is through accessing the blog's feed directly (its a Wordpress blog btw)