# Saving an XML file with a certain passed file name to PHP

**URL:** <https://forum.kirupa.com/t/saving-an-xml-file-with-a-certain-passed-file-name-to-php/201088>\
**Category:** Uncategorized\
**Created:** [September 18, 2006, 1:12pm UTC](https://forum.kirupa.com/t/saving-an-xml-file-with-a-certain-passed-file-name-to-php/201088 "2006-09-18T13:12:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ceetah](https://avatars.discourse-cdn.com/v4/letter/c/f0a364/32.png) [@ceetah](https://forum.kirupa.com/u/ceetah)\
**Post date:** [September 18, 2006, 1:12pm UTC](https://forum.kirupa.com/t/saving-an-xml-file-with-a-certain-passed-file-name-to-php/201088/1 "2006-09-18T13:12:30Z")

</div>

hello.  
i used a kirupa tutorial to save an xml file.

AS:  
[COLOR=#006610]var[/COLOR] [COLOR=#000050]xml\_file[/COLOR] [COLOR=#0000ff]=[/COLOR] [COLOR=#666666]“xmlFileName.xml”[/COLOR];  
[COLOR=#006610]var[/COLOR] [COLOR=#000050]server\_file[/COLOR] [COLOR=#0000ff]=[/COLOR] [COLOR=#666666]“phpFileName.php”[/COLOR];  
[COLOR=#000050]my\_Xml[/COLOR].[COLOR=#0000d0]sendAndLoad[/COLOR][COLOR=#0000ff]([/COLOR][COLOR=#000050]server\_file[/COLOR], [COLOR=#000050]xml\_file[/COLOR][COLOR=#0000ff])[/COLOR];

PHP:  
**[COLOR=#991010]\<?php[/COLOR]** [COLOR=#000050]$filename[/COLOR] [COLOR=#0000ff]=[/COLOR] [COLOR=#666666]“xmlFileName.xml”[/COLOR]; \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
[COLOR=#000050]$raw\_xml[/COLOR] [COLOR=#0000ff]=[/COLOR] [COLOR=#0000d0]file\_get\_contents[/COLOR]COLOR=#0000ff[/COLOR];  
[COLOR=#000050]$fp[/COLOR] [COLOR=#0000ff]=[/COLOR] [COLOR=#0000d0]fopen[/COLOR][COLOR=#0000ff]([/COLOR][COLOR=#000050]$filename[/COLOR], [COLOR=#666666]“w”[/COLOR][COLOR=#0000ff])[/COLOR];  
[COLOR=#0000d0]fwrite[/COLOR][COLOR=#0000ff]([/COLOR][COLOR=#000050]$fp[/COLOR], [COLOR=#000050]$raw\_xml[/COLOR][COLOR=#0000ff])[/COLOR];  
[COLOR=#0000d0]fclose[/COLOR]COLOR=#0000ff[/COLOR];  
**[COLOR=#991010]?\>[/COLOR]**

So I need to save that my\_Xml object to different files… with different file name of course. So the xmlFileName changes all the time inside my flash.  
Now… what can I change in the PHP file… so the $filename receives the value from flash?

example 1:  
xml\_file = “ex1.xml”  
[COLOR=#000050]my\_Xml[/COLOR].[COLOR=#0000d0]sendAndLoad[/COLOR][COLOR=#0000ff]([/COLOR][COLOR=#000050]server\_file[/COLOR], [COLOR=#000050]xml\_file[/COLOR][COLOR=#0000ff])[/COLOR];  
xml\_file = “ex2.xml”;  
[COLOR=#000050]my\_Xml[/COLOR].[COLOR=#0000d0]sendAndLoad[/COLOR][COLOR=#0000ff]([/COLOR][COLOR=#000050]server\_file[/COLOR], [COLOR=#000050]xml\_file[/COLOR][COLOR=#0000ff])[/COLOR];

at the end of this… on my server must appear 2 files: ex1.xml and ex2.xml.

PS: when I run the first script, a blank IE page with the name of the php file appears… how can I get rid of it?

thank you!
