Jump to content


Photo

Saving XML to server ~ sent from Flash to PHP


  • Please log in to reply
1 reply to this topic

#1 bubbadawg

bubbadawg
  • Members
  • PipPip
  • Member
  • 17 posts

Posted 09 July 2006 - 01:50 AM

Hello All ----

I am relatively new to PHP and need some minor assistance. I am passing from Flash to PHP an XML object which I only need PHP to save on the server. The XML file that is being saved is close to correct but has some extraneous characters inserted (" \ "). I am guessing I need to escape or parse them, but not really sure. Here is my PHP code:

<?php
    $filename = "images.xml";
    $receivedData = $_POST['xmlData'];

    $fp = fopen($filename, "w");
    fwrite($fp, $receivedData);
    fclose($fp);
?> 

Here is the a sample of the XML that is saved on the server:

<images>
<album description=\"Description of New Album\" title=\"New Album\" lgPath=\"/\" tnPath=\"gallery//\" tn=\"gallery/sample_tn.jpg\">
<img title=\"Title Here\" imgName=\"sample.jpg\" />
</album>
</images>

Any help is greatly appreciated. Thanks for any and all replies.

#2 willfitch

willfitch
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts
  • LocationNew Hope, PA

Posted 10 July 2006 - 03:43 AM

Hey bubbadawg,

You have magic_quotes_gpc turned on.  Use stripslashes($_POST['xmlData']); and this should solve your issue.


Zend Certified Engineer (ZEND001989)
www.willfitch.com




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users