PDA

View Full Version : Flash, XML, Php & escape characters


AngelEyesShadow
11-27-2003, 11:05 AM
I'm loading an XML file in Flash, I modify it and then I send it to a php script that writes it in the same XML file.
The problem is that Flash writes the "\" character before every ' " '. And the file becomes invalid (cannot be shown in browser).
Is there a way to tell flash not to use the eschape character and annoy me?
Here's the php code, if needed:

<?php
$mesaj="";
$mesaj .= $myxml;
//myxml is a string variable that's been sent from flash
$f = fopen("file.xml", "w");
fputs($f, $mesaj);
fclose($f);
?>

:D

AngelEyesShadow
11-27-2003, 11:08 AM
There's no problem when I don't have any attributes and no references at the beginning of the xml file, such as: <?xml version="1.0"?>...

buggedcom
11-28-2003, 05:39 AM
the reason is quite simple. When you send any strings via post (or get i think) flash sends the string to the server but automatically urlencodes and unescapes the string. so do correct it all you need to do is modify your php slightly

<?php
$mesaj = str_replace("\\\", "", "$myxml");
$f = fopen("file.xml", "w");
fputs($f, $mesaj);
fclose($f);
?>

AngelEyesShadow
12-01-2003, 07:38 AM
Thanx man....
I haven't thought of that...
It works just fine now...
Thanx :D

buggedcom
12-01-2003, 07:40 AM
no probs :)