title: Creating a temporary xml file with php
body: <p>I am trying to create a temporary xml file with php that contains a list of quiz quesstions. The random list is generated from a database in php and I need to save this as a writable temporary xml file until the quiz is complete. I keep getting the following errors:</p>
  <blockquote>
  <p>Warning: simplexml_load_file() [function.simplexml-load-file]: /tmp/quiz7YRGPo:1: parser error : Start tag expected, '&lt;' not found in /home/dir/public_html/website.com/quiz/index.php on line 154</p>
  <p>Warning: simplexml_load_file() [function.simplexml-load-file]: quiz_data.xml in /home/dir/public_html/website.com/quiz/index.php on line 154</p>
  <p>Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home/dir/public_html/website.com/quiz/index.php on line 154</p>
  </blockquote>
  <p>This is the code:</p>
  <pre><code>// name of XMLPHP file which contains quiz data
  
  $xml_file = 'http://website.com/quiz/dynamic_php_page_generates_xml.php?param=var&amp;param2=var2';
  
  
  // create randomXML file
  
  $tempquiz = tempnam('/tmp','quiz');
  $fp_tempquiz = fopen($tempquiz, &quot;w&quot;);
  fwrite($fp_tempquiz, $xml_file);
  //CLOSE temp file
  fclose($fp_tempquiz);
  
  // create new SimpleXML object from XML file
  
  $quiz = simplexml_load_file($tempquiz);
  </code></pre>
  <p>How do I create the temporary xml file with php so that the quiz is unique each time the page is loaded?</p>