Question:
how do i generate an xml file in php to be load in flash?
Snake
2007-10-30 12:28:07 UTC
I'm frustrated, lol. I've tried everything and nothing seems to work. I want to create a php script to generate an xml file to be load in a flash movie. This is an example of my script:

if ($handle = opendir('videos')) {

while (false !== ($file = readdir($handle))) {

if ($file != "." && $file != ".."){

echo "\t\n";
}

}

closedir($handle);
}
?>


i then load the php file in flash using xmlFile.load(php script) but it just don't work. But if i try to write the file in plain xml works spectacular. SOMEBODY PLEASE HELP!! :(
Three answers:
2007-10-30 13:01:40 UTC
i think it should work fine try giving an absolute address. I have used it myself many times it works ok.
pip_kuruvilla
2007-11-01 07:15:01 UTC
I'm not familiar with flash. However, I have used php to generate xml files for other web applications. Try this modified version of your code:


header('Content-type: application/xml');

echo "";

if ($handle = opendir('videos')) {

while (false !== ($file = readdir($handle))) {

if ($file != "." && $file != ".."){

echo "";

}

}

closedir($handle);

}

echo "
";

?>



Changes I've made:

- removed the tab and new line (depending on the Operating system, a new line is indicated by \n, \r or \r\n . However, not using the new line at all won't cause any harm. so, this is safer. You can add it later once you've eliminated any other issue.

- Added an HTTP header. You may have to provide this since web servers usually give the header (text/html) which may not be what flash expects.



One of the above should fix your problem. Otherwise, its something in the file path (is it the correct directory?, are you using the correct upper/lower case for the directory name ).
marcoux
2016-10-03 04:59:25 UTC
Hypertext Preprocessor is a scripted programming language that is utilized to create web pages. Hypertext Preprocessor itself stands for "Hypertext Preprocessor: Hypertext Preprocessor" (the initials genuinely come from the earliest version of this equipment, which replaced into called "Hypertext Preprocessor"). Hypertext Preprocessor enables interplay with a extensive form of relational database administration structures and operates on maximum significant working structures. for greater suggestions verify the source link.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...