Current location: Brighton, UK

PHP-based XML loading proxy for Flash/Flex apps

Posted on Monday, January 29, 2007 @ 15:40 CET

According to Adobe:

For security reasons, a Macromedia Flash movie playing in a web browser is not allowed to access data that resides outside the exact web domain from which the SWF originated.

In order to get around this you can set up a crossdomain.xml file on each domain. However, if you have no control over those domains, which is the case if you're using web-services or reading other XML data, then you have to use a proxy.

So here is a quick PHP proxy I whipped up for use with a project I'm working on. Its just a slight modification of one I found on the Yahoo! Developer site.

I would've done it in Perl but PHP makes it easier to avoid the "module missing" headaches that can crop up when deploying to different servers.

- paulo

Comments:

1
Martin writes:
I can't get it to work. I'm reading an XML from Blizzards website containing World Of Warcraft Character information. And it's all blank.

# January 23, 2008 23:25 CET

2
CK writes:
I couldn't get it too work either..

# June 13, 2008 17:39 CET

3
Paulo Fierro replies:
You can try out Abdul Qabiz's excellent one that has worked for me in the past: http://www.abdulqabiz.com/blog/archives/general/php_proxy_script_for.php

# June 13, 2008 17:43 CET

4
CK writes:
thank you.. i have a small question in regards to this "Post a comment" flash applet displayed here.. Do you know if there is anything that has both the combination of the "Post a comment" form and the "Comments" response built all in one in flash along with the use of php..

# June 13, 2008 17:48 CET

5
Paulo Fierro replies:
I'm not really sure, this comment box is just something I threw together quickly to avoid blog spam since its a SWF so it takes potential spammers just that little extra effort. Its been working so far :)

It communicates with an AMF::Perl service via Flash Remoting, but you could replace that with any other AMF implementation such as AMF-PHP, or plain old XML.

# June 13, 2008 18:00 CET

6
CK writes:
thanks paulo.. i appreciate your input.. i'll try the implementation and see where that gets me.. have a good day :)

# June 13, 2008 18:08 CET

Post a comment:

You must have Flash and JavaScript enabled to post a comment.