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 9172063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:15:21+00:00 2026-06-17T16:15:21+00:00

Im using simplexml to bring in a data feed, and now i want to

  • 0

Im using simplexml to bring in a data feed, and now i want to put that into working varables to use in my php doc.

Following the php.net guides on simplexml ive arrived at

<?php
    $xml = simplexml_load_file('f1_feed.xml');

    $xml = new SimpleXMLElement($xmlstr);

    echo $xml->response->williamhill->class->type->market[0]->name;
?>

but i keep getting a blank page, have i completely missed to point of how to parse the xml and put it into a working var ?

(feed is local for development)

  • 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-17T16:15:23+00:00Added an answer on June 17, 2026 at 4:15 pm

    you don’t need both new SimpleXMLElement and simplexml_load_file:

    • simplexml_load_file Returns an object of class SimpleXMLElement
    • SimpleXMLElement Returns a SimpleXMLElement object

    try:

      if (file_exists('f1_feed.xml')) {
          $xml = simplexml_load_file('f1_feed.xml');    
          print_r($xml);
      } else {
          exit('Failed to open f1_feed.xml.');
      }
    

    or:

    if (file_exists('f1_feed.xml')) {
         $xml = new SimpleXMLElement(file_get_contents('f1_feed.xml'));
         echo $xml->response->williamhill->class->type->market[0]->name;
    } else {
         exit('Failed to open f1_feed.xml.');
    }
    

    if it still doesn’t work, add

      error_reporting(E_ALL);
      ini_set("display_errors", 1);
    

    for better error reporting

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started using SimpleXML to get a feed and display data from that
using simplexml to parse a feed, but I want to grab the date of
The Scenario I am using PHP's SimpleXML to parse a blog feed. The most
I am using the PHP SimpleXML way of working with XML files on my
I'm using SimpleXML to extract images from a public feed @ Flickr. I want
I'm using SimpleXML to create an RSS feed for Google Products and I want
I am using simpleXML in PHP to fetch xml file. The thing is that
I'm using SimpleXML to parse a YouTube search feed. I want to get the
I'm using XML for a config file in PHP (Using SimpleXML), in creating the
How do I convert SOAP response like this to php array using SimpleXML? <?xml

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.