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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:59:10+00:00 2026-06-17T17:59:10+00:00

Im really new to php and im trying to load in data from an

  • 0

Im really new to php and im trying to load in data from an external xml feed into a php document, then use that data to generate an output.

The xml feed im using is – http://whdn.williamhill.com/pricefeed/openbet_cdn?action=template&template=getHierarchyByMarketType&classId=1&marketSort=–&filterBIR=N

What im trying to do is generate a list of ‘markets’ and there names, so as the xml feed stands at the time of writing the first 3 items in the list would be :

  • Scottish Division 1 – Outright – Outright
  • Dumbarton v Hamilton – 1st Half Result/2nd Half Result
  • Dumbarton v Hamilton – Match Handicaps

at the moment im trying to use the code bellow to achieve this, but im getting nowhere quickly with it, any ideas on what im doing wrong here ?

just a further piece of background, im using php 5.4.4, am i right in thinking that simplexml comes already pre installed.. so i dont need to add any thing additional here ?

<?php 

$xml = simplexml_load_file('http://whdn.williamhill.com/pricefeed/openbet_cdn?action=template&template=getHierarchyByMarketType&classId=1&marketSort=--&filterBIR=N');

foreach ($xml->market as $event) {
  echo $event;
}

?>
  • 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-17T17:59:11+00:00Added an answer on June 17, 2026 at 5:59 pm

    You need to drill down through the xml to get the markets, and then get the attributes of the market:

    <?php 
    
    $xml = simplexml_load_file('http://whdn.williamhill.com/pricefeed/openbet_cdn?action=template&template=getHierarchyByMarketType&classId=1&marketSort=--&filterBIR=N');
    
    foreach ($xml->response->williamhill->class->type as $type) {
      $type_attrib = $type->attributes();
      echo "<p><h2>Type ".$type_attrib['id'].": ".$type_attrib['name']."</h2>";
      foreach ($type->market as $event) {
        $event_attributes = $event->attributes();
        echo $event_attributes['name']."<br />";
        //commented out the following which prints all attributes
        //replaced by above to just print the name
        /*
        echo "<p>";
        foreach($event->attributes() as $attrib=>$value) {
          echo "$attrib: $value <br />";
        }
        echo "</p>";
        */
      }
      echo "</p>";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to load an xml file from wikipedia into my flash movie.
I'm really new to PHP and Im trying to append Nodes to XML using
I am really new to php, and this is what I am trying to
I'm really new to xml, with this being my first dip into it. I'm
I am trying to read this XML document with php. https://raw.github.com/yosoyadri/GeoNames-XML-Builder/master/continents-countries-statesprovinces.xml That is what
I'm brand new to PHP/MYSql and I'm trying to build a form that submits
I am really new with PHP and all I have to do is to
Rather new to php, so sorry if this seems stupid. I'm really copying a
Well I'm new to PHP but thinking about these stuff has really confused me
I'm fairly new to PHP and MongoDB so it would be really helpful if

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.