Thursday, 31 December 2015

XML : displaying xml child elements in PHP

Not a total n00b but never really dabbled with XML

I have an XML feed which when queried returns this response

  <ContentAPI xmlns="http://www.geneity.co.uk/genbet/ContentAPI" status="OK" timezone="UTC" msg_stamp="MDoxO  mVu" version="1.0" request="get_events_for_type">  <Sport sport_code="FOOT" name="Football">  <SBClass sb_class_id="12430" name="United Kingdom">  <SBType sb_type_id="19157" name="Barclays Premier League">  <Ev inplay_allowed="Y" status="A" name="Aston Villa v Norwich City" start_time="2012-10-  27T11:45:00" ev_timezone="Europe/London" inplay_now="N"mkt_count="102" ev_id="26301">  <Teams>  <Team team_id="1323" team_order="0" name="Aston Villa" short_name="Aston Villa"/>  <Team team_id="136" team_order="1" name="Norwich City" short_name="Norwich City"/>  </Teams>  ….  </SBType>  </SBClass>  </Sport>  </ContentAPI>    

I can't figure how to loop the results to be formatted like Barclays Premier League Start Time - 1st team name( team_order 0 ) - 2nd team name( team_order 1 )

Any help would be hugely appreciated. I'm just pulling my hair out at the minute because I know its something easy

No comments:

Post a Comment