Thursday, March 15, 2012

Using Flex HTTPService to handle RSS with PHP

If you are using HTTPService in flex or using flash actionscript to handle RSS feed, you might found that not all RSS feed is supported by flex. This is due to flex can only access any feeds that have cross-domain.xml in their root directory of the web-server.

What happen if the website supplying the feed don't have cross-domain.xml or limited to certain website to access it by defined rules in the xml files. How to handle that?

I found a way with the help of php.

As usual, in your flex applications, you will have this line of code:

showBusyCursor="true" method="GET" resultFormat="object" />

and somewhere in your code, you have it called
myHttpSvc.url = "";

and you php should contains this line of code:
class rssfeed{
    public function getRssFeed($urlAdd){
       return file_get_contents( $urlAdd );

$sp = new rssfeed();
echo ($sp->getRssFeed(%_GET['urlToPass']));

That should do the trick. Now you can access any rss feed any feed into you flash / flex code without worrying about cross-domain.xml anymore.


Share It

Popular Posts