Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Security Error #2048 with crossdomain.xml file

New Here ,
Apr 20, 2009 Apr 20, 2009

I am using the XML/MX/Syndication libraires and getting a Security Error #2048 error. The error seems unreasonable to me in that there is no forward solution to it on the Internet. I have tried hardcoding security methods in AS 3 and also using a crossdmain.xml file in my root directory to no success. I am about to give up and use pure PHP. There should be a more simple solution to this.

TOPICS
ActionScript
3.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 24, 2009 Apr 24, 2009

you php file needs to read the xml feed and then you can echo that back to flash.

Translate
Community Expert ,
Apr 20, 2009 Apr 20, 2009

if you're trying to load an xml file/feed from one domain into a swf on another domain, you're going to have a cross-domain security issue.  to remedy, call a php file on the same domain as the swf, have the php script load the other-domain xml file and feed that xml file to your swf.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 21, 2009 Apr 21, 2009

First I want to say thanks for the help. It was real hard searching for this answer.

I am writing something like this in my index.php page that calls the galaxy.php script which calls the swf file.

<?php
     include( $_SERVER['DOCUMENT_ROOT'] . 'http://www.jpl.nasa.gov/multimedia/rss/news.xml');
     include 'galaxy.php';

?>

Now at least I get this error:

IOError : Error #2032

My A3 is:

const RSS_URL:String = "http://www.journeyon.us/news.xml";
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 21, 2009 Apr 21, 2009

you're welcome.

(but i don't see where you're as3 is calling your php file and it's not clear what your php file is doing.)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 21, 2009 Apr 21, 2009

The URL is called in the timeline before the button load event that loads the RSS feed.

In my index.php file, first I am trying to include the xml file to my server root directory and then load in the swf file.

I am not sure if this is the correct way to do it though.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 21, 2009 Apr 21, 2009

use the urlloader class to call your php script and a listener for the return from that script.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 22, 2009 Apr 22, 2009

it wants to parse the RSS xml file and errors out if it's a php file.

How can I retrieve the xml file from the php file?

I'm doing something like this:

function onDataLoad(e:Event):void

{

     // get the raw string data from the feed

     var rawRSS:String = URLLoader(e.target).data;

     //parse it as RSS

     parseRSS(rawRSS);

}

but I am capturing a PHP file that loads the XML file not the pure XML file.

Maybe use this to retrive the exact variables:

request.data = new URLVariables();
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 24, 2009 Apr 24, 2009

I am getting an invalid XML data error while using URLRequestMethod.GET

with the php file:

In the file is

<?php include 'http://www.jpl.nasa.gov/multimedia/rss/news.xml'; ?>

It's proabably reading the php syntax and then erroring

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 24, 2009 Apr 24, 2009

you php file needs to read the xml feed and then you can echo that back to flash.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 16, 2009 May 16, 2009

I am using htmlentities() here. It's working great and I print out exactly the source that the original xml file contains.

But it still can't read it. Maybe it's because it's a PHP file and not .XML?

<?php 
$url = 'http://www.jpl.nasa.gov/multimedia/rss/news.xml';
$xml = simplexml_load_file($url) or die ("Unable to load XML file!");

//echo '<pre>'.htmlentities(print_r($xml, 1)).'</pre>';
echo htmlentities("<?xml version='1.0'?>");
echo htmlentities("<rss version='2.0'>");
echo htmlentities("<channel>");
 
foreach ($xml->channel->item as $item)
{
    echo htmlentities("<item>");
    echo htmlentities("<title>");
    echo $item->title;
    echo htmlentities("</title>");
    echo htmlentities("<link>");
    echo $item->link;
    echo htmlentities("</link>");
    echo htmlentities("<description>");
    echo $item->description;
    echo htmlentities("</description>");
    echo htmlentities("<pubDate>");
    echo $item->pubDate;
    echo htmlentities("</pubDate>");
    echo htmlentities("</item>");
}

echo htmlentities("</channel>");
echo htmlentities("</rss>");
?>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
May 17, 2009 May 17, 2009

You shouldn't be using htmlentities in php to generate xml for loading in actionscript in this case.

htmlentities encodes the xml tags so they can be viewed in a browser as html.

When you're loading the xml with flash you want the raw xml without html entity encoding.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 17, 2009 May 17, 2009
LATEST

I just added this to the top and it produces a raw XML file.

header("Content-Type: text/xml");

removed this:

echo "<?xml version='1.0'?>";

works now.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines