2177 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Community Moderator
  • Bought between 50 and 99 items
  • Referred between 200 and 499 users
  • Has been a member for 5-6 years
  • Won a Competition
+10 more
mpc Volunteer moderator says

Hi, I am using Wikipedia API to get some info for me masters degree app, I run into a trouble when I test it localy everything works great but on the server I dont get the info from the API , any idea? I load the xml from URL like this http://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles=Something&rvprop=content

128 posts
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Romania
  • Has been a member for 6-7 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Bought between 1 and 9 items
  • Referred between 1 and 9 users
ram64 says

Try fetching the XML content first by a PHP script on your server and then load it into Flash. You can’t load files from another doman unless a policy (crossdomain.xml) file exists on that domain and gives you permission.

Here’s an example how you can do it. Of course, you can simplify the PHP script by using DOMDocument class.

2177 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Community Moderator
  • Bought between 50 and 99 items
  • Referred between 200 and 499 users
  • Has been a member for 5-6 years
  • Won a Competition
+10 more
mpc Volunteer moderator says

So why it does work from a local host?

128 posts
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Romania
  • Has been a member for 6-7 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Bought between 1 and 9 items
  • Referred between 1 and 9 users
ram64 says

Because that’s how the security sandbox works. I’m not sure why (never read the entire security documentation) so I can’t explain. You can read more about it here.

2177 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Community Moderator
  • Bought between 50 and 99 items
  • Referred between 200 and 499 users
  • Has been a member for 5-6 years
  • Won a Competition
+10 more
mpc Volunteer moderator says

I am still not sure why I can load it from PHP but cant from Flash, its a magic :) If anyone have some solution please share it!

3069 posts
  • Has been a member for 6-7 years
  • Won a Competition
  • Sold between 50 000 and 100 000 dollars
  • Bought between 10 and 49 items
  • Referred between 50 and 99 users
  • Exclusive Author
  • Romania
wickedpixel says

Because php does not need policy to load external files, Flash does. So.. this way you use php as proxy to trick the policy thinghie. Flash reads the php because the php is on your server.

128 posts
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Romania
  • Has been a member for 6-7 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Bought between 1 and 9 items
  • Referred between 1 and 9 users
ram64 says

I am still not sure why I can load it from PHP but cant from Flash, its a magic :) If anyone have some solution please share it!

As wickedpixel said, PHP does not have the same security limitations as Flash. And when you use a PHP script to fetch the XML data you would probably use it on the same domain as the SWF file that’s why you can load data from it.

For a solution read what I’ve said above. There’s a link to an example on how to use PHP to fetch XML data from outside your domain.

556 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Referred between 10 and 49 users
  • Sold between 1 000 and 5 000 dollars
  • United States
ThemeScience says

Your best workaround is to get a simple PHP proxy script, for your “external” xml.

Flash doesn’t like reading files from other domains, unless a crossdomain.xml is present allowing you to do so, and that is because back in the day, developers used to suck alot of bandwidth from other sites.

If you need a simple proxy hit me up and ill shoot one to you.

Cheers

by
by
by
by
by
by