XML reflector

software development

#1

newbie question, easy on the flaming pls

I’ve got a flash app that sources RSS feeds from an external domain (a parameter in flash vars), and in setting it up, cross domain xml required that I reflect the xml locally. So a web page embeds a flash app using flash vars. The flash app gets the xml feed from a php prog in the same folder which converts the remote xml feed to a local xml feed which the flash app can read.

The problem is that my programmer made it work in php without knowing that DH doesn’t support ‘function.file-get-contents’. I’ve looked into the curl pages and thought http://www.wiki.dreamhost.com/CURL_PHP_tutorial would be helpful, but I need a little more help.

The PHP that works on the programmers web server is:

<?php $feed = $_GET['feed']; echo (file_get_contents("http://".$feed)); ?>

and that code that I’m been tinkering with from the cURL above is:

<?php function My_simplexml_load_file($URL) { $ch = curl_init($URL); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); $xml = simplexml_load_string(curl_exec($ch)); curl_close($ch); return $xml; } ?>

but my tweaking has proved fruitless. Are there any special variable names I need to modify?

The flash var in the embed is:

note: the original php concatenates the "http://" to avoid the redirect caused by using that structure.

There’s got to be some really easy way that someone has posted elsewhere.

Thx.


#2

The goal here is just to pass an XML file from some outside your domain through your domain so that the Flash applet thinks that the XML was originally generated locally, yes? You’re not performing any modifications to the XML itself?

If that’s the case, you should take a look at the curl_exec documentation and pay particular attention to “Example#1 Fetching a web page”


#3

@Alpicola - thx, I’ll give that a try. you’re right in that there’s no modification of the xml.

I may get stuck since I’m trying to use pass a variable from “flash vars” from my flash app to the php prog to reflect the xml.