2210 posts
  • Has referred 200+ members
  • Has sold $500,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+13 more
mpc 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

140 posts
  • Sells items exclusively on Envato Market
  • Has sold $1,000+ on Envato Market
  • Has been part of the Envato Community for over 6 years
  • Has been a beta tester for an Envato feature
+6 more
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.

2210 posts
  • Has referred 200+ members
  • Has sold $500,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+13 more
mpc says

So why it does work from a local host?

140 posts
  • Sells items exclusively on Envato Market
  • Has sold $1,000+ on Envato Market
  • Has been part of the Envato Community for over 6 years
  • Has been a beta tester for an Envato feature
+6 more
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.

2210 posts
  • Has referred 200+ members
  • Has sold $500,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+13 more
mpc 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!

3072 posts
  • Has referred 50+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Had an item featured on Envato Market
+5 more
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.

140 posts
  • Sells items exclusively on Envato Market
  • Has sold $1,000+ on Envato Market
  • Has been part of the Envato Community for over 6 years
  • Has been a beta tester for an Envato feature
+6 more
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
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+4 more
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

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by