# HELP! Using PHP, Flash and XML to rewrite file

**URL:** <https://forum.kirupa.com/t/help-using-php-flash-and-xml-to-rewrite-file/206788>\
**Category:** programming\
**Created:** [November 11, 2006, 10:32am UTC](https://forum.kirupa.com/t/help-using-php-flash-and-xml-to-rewrite-file/206788 "2006-11-11T10:32:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dezamp](https://avatars.discourse-cdn.com/v4/letter/d/22d042/32.png) [@dezamp](https://forum.kirupa.com/u/dezamp)\
**Post date:** [November 11, 2006, 10:32am UTC](https://forum.kirupa.com/t/help-using-php-flash-and-xml-to-rewrite-file/206788/1 "2006-11-11T10:32:52Z")

</div>

```php
<?php
$file = fopen("user.xml", "w+") or die("Can't open XML file");
$xmlString = $HTTP_RAW_POST_DATA; 
if(!fwrite($file, $xmlString)){
    print "Error writing to XML-file";
}
print $xmlString."
";
fclose($file);
?>

```

I have this code currently from a Kirupa tutorial but this only adds to the xml file. I want it so that it will completely rewrite the xml. Please help!
