Read XML data and write to new file with PHP

xenobit

New Member
I may be over thinking this but are there any extra steps I am missing after reading my XML data into a string and before writing it to a local file?\[code\]header('Content-type: text/xml');//MY URL TO A XML PAGE STYLED WITH XML STYLE SHEET$url = "http://www.mywebsite.com/somexmlfile.xml";//SAVE CONTENTS OF PAGE IN XML_DATA$xml_data = http://stackoverflow.com/questions/6927852/file_get_contents($url);//REMOVE STYLE SHEET INFO$search2 ='<?xml-stylesheet href="http://stackoverflow.com/questions/6927852/latest_ob.xsl" type="text/xsl"?>';$xml_data = http://stackoverflow.com/questions/6927852/str_replace( $search2,"", $xml_data);//WRITE MY DATA TO A BACKUP FILE AND THEN ECHO TO THE SCREEN FOR A FLASH APP CALLING THE INFO $myFile = "data_backup.xml"; $fh = fopen($myFile, 'w') or die("can't open file"); $stringData = http://stackoverflow.com/questions/6927852/$xml_data; fwrite($fh, $stringData); fclose($fh); echo $xml_data;\[/code\]The reason I ask this is when I try opening my backup XML file in Dreamweaver it crashes everytime. I was thinking there could be an encoding issue possible.
 
Top