- Sold between 250 000 and 1 000 000 dollars
- Exclusive Author
- Community Moderator
- Author was Featured
- Bought between 10 and 49 items
- Referred between 200 and 499 users
- Has been a member for 4-5 years
- Won a Competition
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
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.
- Sold between 250 000 and 1 000 000 dollars
- Exclusive Author
- Community Moderator
- Author was Featured
- Bought between 10 and 49 items
- Referred between 200 and 499 users
- Has been a member for 4-5 years
- Won a Competition
So why it does work from a local host?
- Sold between 250 000 and 1 000 000 dollars
- Exclusive Author
- Community Moderator
- Author was Featured
- Bought between 10 and 49 items
- Referred between 200 and 499 users
- Has been a member for 4-5 years
- Won a Competition
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!
- Community Superstar
- Item was Featured
- Author was Featured
- Has been a member for 5-6 years
- Won a Competition
- Sold between 50 000 and 100 000 dollars
- Bought between 10 and 49 items
- Referred between 50 and 99 users
- Europe
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.
mpc said
I am still not sure why I can load it from PHP but cant from Flash, its a magicIf 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.
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
