You are here: sending XML data from PHP to Flash « All PHP « IT news, forums, messages
sending XML data from PHP to Flash

Posted by jaschreiber on 11/17/06 22:15

Hi,
I'm trying to figure out how to pass data back and forth from a mysql
database to flash using PHP as the intermediary. i have a handle of
the flash side of the deal- it's working out fine using the XML
..sendAndLoad() functions... however, i can't seem to get it to come
together with php.

i'm using the following (simple) code, just to get started:

##### BUTTON #####
on(release){
loginXML = new XML();
loginElement = loginXML.createElement("LOGIN");
loginElement.attributes.username = "jason";
loginElement.attributes.password = "password";
loginXML.appendChild(loginElement);
_level0.disp = loginXML;

loginReplyXML = new XML();
loginReplyXML.onLoad = onLoginReply;


loginXML.sendAndLoad("process.php", loginReplyXML);
}

##### FRAME ACTIONS ######
function onLoginReply(){
// Get the first XML element

var e = this.firstChild;
_level0.disp += loginReplyXML;

if (e.nodeName == "LOGINREPLY" && e.attributes.STATUS == "OK"){
// Save the session ID for future communications with server
sessionID = e.attributes.SESSIONID;
//_level0.disp =+ sessionID;
trace (sessionID);
} else {
// Login failed! Go to the login failure sceren
_level0.disp += "Login Failed";
}
}

The thing is that the code works fine when i change the sendAndLoad (in
the button code) to "process.xml" (and load a static xml file
containing one line of dummy data: <LOGINREPLY STATUS="OK"
SESSIONID="dsljdlkjfasdlkjfaldkjflakdsj" />

but when i switch it back to "process.php" it no XML gets loaded into
flash. i know that the problem must be in my php script, but even when
i dumb that down to the following i get errors:

<?php
header("Content-type: text/xml");
echo '<LOGINREPLY STATUS="OK" SESSIONID="dsljdlkjfasdlkjfaldkjflakdsj"
/>';
?>

any ideas on what the problem is??
sorry this was so rambling.
Jason

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация