Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

piping php-generated xml to flash

0 views
Skip to first unread message

Henri

unread,
Dec 17, 2005, 7:17:47 AM12/17/05
to

Hello,

I'm building a photo gallery using flash as a front-end to a mysql
database. I use php to query the database.
I was wondering if it was possible to generate xml into a stream that
would be directly piped to flash.
See, normally one would use php to write an xml file that would then be
read by flash eg.

xmlData = new XML();
xmlData.load("query_results.xml")

what I want is this: xmlData.load("query.php") where query.php would be
something like

<?php

echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>"
echo "<images>";
echo "<img_data>";
echo "<val title=\"$title\"/>
echo "<val path=\"$path\"/>
echo "</img_data>
echo "</images>

?>

Henri

--

The Dude once said,
"Yeah, well, you know, that's just, like, your opinion, man."

Nicholas Sherlock

unread,
Dec 17, 2005, 8:50:59 PM12/17/05
to
Henri wrote:
> what I want is this: xmlData.load("query.php") where query.php would be
> something like
>
> <?php
>
> echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>"
> echo "<images>";
> echo "<img_data>";
> echo "<val title=\"$title\"/>
> echo "<val path=\"$path\"/>
> echo "</img_data>
> echo "</images>
>
> ?>

Yes? That sounds fine, what problems are you having with it? You may
need to call:

Header('Content-type: text/xml');

before you start echo'ing.

Cheers,
Nicholas Sherlock

NC

unread,
Dec 18, 2005, 6:09:22 PM12/18/05
to
Henri wrote:
>
> I'm building a photo gallery using flash as a front-end to
> a mysql database. I use php to query the database.
> I was wondering if it was possible to generate xml into
> a stream that would be directly piped to flash.

Sounds doable...

> See, normally one would use php to write an xml file that
> would then be read by flash eg.
>
> xmlData = new XML();
> xmlData.load("query_results.xml")
>
> what I want is this: xmlData.load("query.php") where
> query.php would be something like
>

> echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>"
> echo "<images>";
> echo "<img_data>";
> echo "<val title=\"$title\"/>
> echo "<val path=\"$path\"/>
> echo "</img_data>
> echo "</images>

You might consider two things:

1. Add header('Content-type: text/xml') at the beginning
of your script.

2. Consider xmlData.load("http://localhost/query.php");
otherwise, PHP interpreter may not be called and Flash
will access the PHP source code, not the XML the
script is supposed to generate.

Cheers,
NC

Henri

unread,
Dec 19, 2005, 8:49:22 AM12/19/05
to

Thanks Nicholas.

In fact, I somehow knew it was possible just after hitting the sent
button. "voicing" the question gave me the answer. I've tried it and
after several attempts managed to get it to work. oh, and you don't need
the Header('Content-type: text/xml') thing, or ,at least, it works well
without it.

This flash:php:mysql:xml stuff is quite exciting!

Henri

unread,
Dec 19, 2005, 8:53:01 AM12/19/05
to

Thanks

Henri

unread,
Dec 19, 2005, 1:46:38 PM12/19/05
to

I correct that: Header('Content-type: text/xml') is needed.

0 new messages