Welcome to WebmasterWorld Guest from 54.204.219.143

Forum Moderators: open

Message Too Old, No Replies

Connecting to XML

     
7:03 am on Dec 26, 2010 (gmt 0)

New User

5+ Year Member

joined:Jan 28, 2010
posts:26
votes: 0


Hi, is it possible to link to xml files from different websites? I have a code for a video player on my site and when the xml file is on my site, the player works. But when the xml file is on another website, the player doesn't play that file.

The line of code I'm using is:
<param name="FlashVars" value="configxml=videofiles/videofile.xml" />


The one above works because it's linking to a file on the site. But when I need to link to another site where I have xml files, I tried:
<param name="FlashVars" value="configxml=http://www.example.com/videofiles/videofile.xml" />

But that didn't work, any ideas how I can fix this?


Thanks for the help

[edited by: httpwebwitch at 8:00 am (utc) on Dec 26, 2010]
[edit reason] use example.com [/edit]

7:59 am on Dec 26, 2010 (gmt 0)

Senior Member from CA 

WebmasterWorld Senior Member httpwebwitch is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 29, 2003
posts:4061
votes: 0


in one situation, the flash movie is reading from a file on the local file system. in the other, it has to make an HTTP request. I assume either the swf isn't wired up to make an HTTP request for the XML, or there may be a cross-domain permission issue.

your solution is to create a proxy on your server that fetches the XML remotely, and serves it locally.

It can be done with one line of code:

<?php
echo file_get_contents("http://example.com/file.xml");
?>

BTW this is the same thing you'd do if you needed to fetch remote data via AJAX.