Okay… Basically I’m trying to write to an XML file with updated information.
But my fwrite() function keeps returning the following error:
Warning: fwrite(): supplied argument is not a valid stream resource in [file path/name] on line 122
So can anybody tell me why the following isn’t a valid string:
<?xml version="1.0"?>
<sitedata>
<siteinfo>
<page>
<pagename><![CDATA[MainPage]]></pagename>
<maintable><![CDATA[This is the text for the Main page.]]></maintable>
<subtable><![CDATA[This is subtable text for the Main page.]]></subtable>
<infotable><![CDATA[<p>Contemporary Service: 8:30am<br />(dress casual)</p><p>Sunday School and Adult Bible Study: 10:00am</p><p>Traditional Service: 11:00am</p><p>Evening Worship: 6:00pm</p>]]></infotable>
<pastortable><![CDATA[Please click on any of the links to the right to browse the website.]]></pastortable>
</page>
</siteinfo>
<userinfo>
<user>
<login>administrator</login>
<password>geothermalnuclearwar</password>
</user>
</userinfo>
<audiolinks>
<link>
<text>07.16.06</text>
<hyperlink>audio/071606.mp3</hyperlink>
</link>
</audiolinks>
</sitedata>
It is a single line with
for line breaks, stored in a variable ($xmlOutput – isn’t it quaint) and then used in the fwrite() command as follows:
if (fwrite($xml_file, $xmlOutput) === FALSE) {
die("Cannot write to file ($xml_file)");
}
What do you think? Am I missing some funky reserved character or something? I’ve looked all over but I’m not finding anything… I’d appreciate your help!