Jump to content

Extract live feeds from an xml page.


unistake

Recommended Posts

Hi all,

I am trying to extract some information from a website, however need some help in to how to put the xml files in to php variables.

 

I understand just about this code!

<?php 
$data = file_get_contents("http://www.bluesq.com/bluesq_php/cubs/cubs.php?action=getpage&thepage=385.xml");
?>

 

However the data in the page above is repeated with different values like this..

<BSQCUBS Version="0.04" Date="Thu Jul 23 16:00:39 BST 2009" MachineDate="Thu, 23 Jul 2009 16:00:39 +0100">
−
<Class class_id="385">
<Title>Football Matches</Title>
−
<Type type_id="5143" type_minbet="0" type_maxbet="0">
<Title>UEFA Europa League</Title>
−
<Event start_time="2009-07-23 16:00:00" ev_id="1948510" ev_minbet="0.01" ev_maxbet="1000.0" racetype="" tracktype="" handicap=" " trifecta=" " eligibility="" distance="" going="0" class="0">
<Description>Karabakh Agdam v Rosenborg</Description>
−
<Market mkt_typ="Win/Draw/Win" lp_avail="Y" sp_avail="N" mkt_id="3054130">
−
<Occurrence bet_id="23101981" lp_num="1" lp_den="4" decimal="1.25" oc_minbet="0.5" oc_maxbet="500.0">
<Description>Rosenborg</Description>
</Occurrence>
−
<Occurrence bet_id="23101980" lp_num="15" lp_den="4" decimal="4.75" oc_minbet="0.5" oc_maxbet="80.0">
<Description>Draw</Description>
</Occurrence>
−
<Occurrence bet_id="23101979" lp_num="11" lp_den="1" decimal="12" oc_minbet="0.5" oc_maxbet="230.0">
<Description>Karabakh Agdam</Description>
</Occurrence>
</Market>

There are several other 'Markets' in the xml file however I would like to extract the above so that I can have something in the order of...

 

$game_date = EventStartTime;
$homeodds = EventDecimals;
etc

 

If anyone knows how to do this it would be much appreciated, also any links for learning this sort of extraction would be great.

 

Thanks

Link to comment
Share on other sites

  • 3 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.