Reading php generates XML in flash?

Here is part 1 of our problem (Loading a dynamically created XML file as PHP in Flash) .

Now we managed to get Flash to read the XML file, but we can only see the Flash visualization correctly when testing (test movie) from the actual Flash program. However, when we upload our files on the Internet to view Flash, it does not display correctly, it lacks important information (thumbnails, titles, videos, etc.).

Additional Information:

The SWF file exists in domain 1. The XML and PHP file exists in domain 2. And the HTML file with the embed code is in domain 3

I wonder if this could be a crossdomain problem? We have one of these files on domains 1 and 2, where we have access, however for domain 3 we cannot have a crossdomain.xml file.

Here is the PHP code:

$xml = new XMLWriter();
$xml->openMemory();
$xml->setIndent(true);
$xml->setIndentString("\t");
$xml->startDocument();
$xml->startElement('data');
$xml->startElement('config');
    $xml->startElement('hex');
        $xml->writeCData('0x' . $widget_profile['background_color']);
    $xml->endElement();
    $xml->startElement('width');
        $xml->writeCData($widget_profile['width']);
    $xml->endElement();
    $xml->startElement('height');
        $xml->writeCData($widget_profile['height']);
    $xml->endElement();
    $xml->startElement('fullscreen');
        $xml->writeCData('false');
    $xml->endElement();
    $xml->startElement('special');
        $xml->writeCData('false');
    $xml->endElement();
    $xml->startElement('specialName');
        $xml->writeCData('Tools & Offers');
    $xml->endElement();
    $xml->startElement('specialLink');
        $xml->writeCData('XXXXXX');
    $xml->endElement();
    $xml->startElement('client');
        $xml->writeCData($widget_profile['site_url']);
    $xml->endElement();
$xml->endElement();

if (count($widget_content) > 0) {
    foreach ($widget_content as $tab) {
        $xml->startElement('tab');
        $xml->writeAttribute('id', $tab['tabname']);

        if (count($tab['video']) > 0) {
            foreach ($tab['video'] as $video) { 
                $video_sql = "select VID, flvdoname, title
                              from video 
                              where VID='" . $video . "'";

                $video_result = $howdini->query($video_sql);

                if ($video_result->rowCount() > 0) {
                    foreach ($video_result as $video_row) {

                        $video_row['flvdoname'] = substr($video_row['flvdoname'], 35, -4);

                        $xml->startElement('vid');
                        $xml->writeAttribute('flv', $video_row['flvdoname']);
                        $xml->writeAttribute('thumb', 'XXXXXXXXX' . $video_row['VID'] . '.jpg');
                        $xml->writeAttribute('title', $video_row['title']);
                        $xml->endElement();
                    }
                }

            }
        }

        $xml->endElement();
    }
}
$xml->endElement();
$xml->endDocument();
header('Content-Type: text/xml; charset=UTF-8');
echo $xml->flush();

Thanks in advance for any answers! EDIT: I have included this change and now Firebug sees XML. Now he just does not see the swf file, but I can see the swf file in other parts of the page.

+2
source share
2 answers

Not a complete solution, but just a data point (because encoding problems suck). When I loaded your XML through a static file and a PHP file and changed them, I got the following results

% diff php.xml static.xml
1c1
< <?xml version="1.0"?>
---
> <?xml version="1.0"?>
10a11
>
19a21
>

Your static file has an extra non-ASCII character at the beginning of it.

, XML UTF-8, PHP , - UTF-8. XML PHP , , .

PHP, ( -, ).

header('Content-Type: text/html; charset=UTF-8') 
+1

, . charset = UTF-8 php. , .

+1

Source: https://habr.com/ru/post/1735677/


All Articles