Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9221477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:35:16+00:00 2026-06-18T03:35:16+00:00

I am trying to create a temporary xml file with php that contains a

  • 0

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:

Warning: simplexml_load_file() [function.simplexml-load-file]: /tmp/quiz7YRGPo:1: parser error : Start tag expected, ‘<‘ not found in /home/dir/public_html/website.com/quiz/index.php on line 154

Warning: simplexml_load_file() [function.simplexml-load-file]: quiz_data.xml in /home/dir/public_html/website.com/quiz/index.php on line 154

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home/dir/public_html/website.com/quiz/index.php on line 154

This is the code:

// name of XMLPHP file which contains quiz data

$xml_file = 'http://website.com/quiz/dynamic_php_page_generates_xml.php?param=var&param2=var2';


// create randomXML file

$tempquiz = tempnam('/tmp','quiz');
$fp_tempquiz = fopen($tempquiz, "w");
fwrite($fp_tempquiz, $xml_file);
//CLOSE temp file
fclose($fp_tempquiz);

// create new SimpleXML object from XML file

$quiz = simplexml_load_file($tempquiz);

How do I create the temporary xml file with php so that the quiz is unique each time the page is loaded?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T03:35:17+00:00Added an answer on June 18, 2026 at 3:35 am

    $xml_file contains the URL of your file, not the actual XML content. You should read it first, with the file_get_contents function, for example :

    $xml_content = file_get_contents($xml_file);
    fwrite($fp_tempquiz, $xml_content);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a temporary file from an entry in my database. I
I am trying to figure out how to create a temporary table that is
Trying to create Database as follows: USE Master GO IF NOT EXISTS(SELECT [Name] FROM
I am trying to use the aws sdk for php to create temporary credentials
I'm trying to create a temporary text file in C++ and then delete it
I am trying to create a temporary cursor that can iterate over my data
i want to create a temporary directory after that i should create a file
I am trying to create a temporary file in /data/local/tmp directory. The path is
I am trying to create dynamic excel sheet, with the help of php using
I'm trying to build a set of results from a query in a PHP

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.