THOR
09-06-2002, 02:10 AM
i have a flash file to output xml formatted text to a php file, which works fine
i have an xml file that has this text
<?xml version="1.0" encoding="iso-8859-1" ?><!DOCTYPE chat>
<chat></chat>
giving me a chat node to place childnodes into.
my php is the problem
I am trying to write the formatted xml from flash, to the .xml file between <chat> and </chat> so that the new one is on the top of the older entries
<chat>
<new></new>
<old></old>
</chat>
I am trying to use preg_match to locate "<chat>" so i can place the entry behind it, to no avail,
my php looks like this
$filename = "chat.xml";
$fp = fopen( $filename,"r");
$OldData = fread($fp, filesize('chat.xml'));
preg_match ("/<chat>/s", $OldData, $matches);
fclose( $fp );
not really sure what is needed for preg_match
and then for $new in the next section, which variables to use to write the new xml
$Input = $GLOBALS["HTTP_RAW_POST_DATA"];
$New = " ";
$fp = fopen( $filename,"w+");
fwrite($fp, $New, 80000);
fclose( $fp );
any help would be great, i have seen alot of different posts on this subject, but i am new at php and cant seem to get it to work
i have an xml file that has this text
<?xml version="1.0" encoding="iso-8859-1" ?><!DOCTYPE chat>
<chat></chat>
giving me a chat node to place childnodes into.
my php is the problem
I am trying to write the formatted xml from flash, to the .xml file between <chat> and </chat> so that the new one is on the top of the older entries
<chat>
<new></new>
<old></old>
</chat>
I am trying to use preg_match to locate "<chat>" so i can place the entry behind it, to no avail,
my php looks like this
$filename = "chat.xml";
$fp = fopen( $filename,"r");
$OldData = fread($fp, filesize('chat.xml'));
preg_match ("/<chat>/s", $OldData, $matches);
fclose( $fp );
not really sure what is needed for preg_match
and then for $new in the next section, which variables to use to write the new xml
$Input = $GLOBALS["HTTP_RAW_POST_DATA"];
$New = " ";
$fp = fopen( $filename,"w+");
fwrite($fp, $New, 80000);
fclose( $fp );
any help would be great, i have seen alot of different posts on this subject, but i am new at php and cant seem to get it to work