Trouble parsing my XML Feed

Experts,
For the last few years, I've purchased baseball scores and insert them into my database.  I wrote a script (with the help from some EE members) to do this automatically every day.  This has worked great for 3 years.
Here is the XML of last night's baseball scores:  http://www.officepickem.com/rftwscores/xml/BaseballScores10-2-15.xml

As of October 1st, the company where I purchase the feeds from updated their infrastructure and my scripts can no longer read the feeds.  I can't figure out what changed.

I'm now getting this error every day:  Invalid argument supplied for foreach()

Any ideas?
-dsg

$xml = "http://www.officepickem.com/rftwscores/xml/BaseballScores10-2-15.xml";
$obj = SimpleXML_Load_File($xml);
 
// CREATE AN OBJECT ITERATOR
foreach ($obj->{"sports-content"}->schedule->{"sports-event"} as $game_data)
{
 
// GET ISO8601-FORMAT DATE ( == MySQL DATETIME )
   $date_time = $game_data->{"event-metadata"}["start-date-time"];
 
// CLEAR ARRAYS FOR CONTEST DATA
   $team_name    = array();
   $team_score   = array();
   $team_decided = array();
   $team_key 	 = array();
 
// CREATE ANOTHER OBJECT ITERATOR
   foreach ($game_data->team as $thing)
   {
      $team_name[]    = $thing->{"team-metadata"}->name["first"] . ' ' . $thing->{"team-metadata"}->name["last"];
      $team_key[] 	  = $thing->{"team-metadata"}["team-key"];
	  $team_score[]   = $thing->{"team-stats"}["score"];
      $team_decided[] = $thing->{"team-stats"}["event-outcome"];
   }
 
// VISUALIZE RESULTS
   echo "<BR>";
   echo $team_name[0];
   echo "  -  ";
   echo $team_key[0];
   echo "  -  ";
   echo $team_score[0];
   echo "  -  ";
   echo $team_decided[0];
   echo "<P>";
   
   echo $team_name[1];
   echo "  -  ";
   echo $team_key[1];
   echo "  -  ";
   echo $team_score[1];
   echo "  -  ";
   echo $team_decided[1];
   echo "<P>";
   echo "<p><HR>";

Open in new window

dsg138Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
hmm, do you have an old feed file? Then create an XSD from the old file and one from the new file. Then compare those files.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dsg138Author Commented:
Good idea.  Here is a copy of one from a few years ago that currently works with my scripts:
http://www.officepickem.com/rftwscores/xml/Day7.xml
The first line seems to be different, but not sure if it's causing the problem.
<xts:sports-content-set>
0
dsg138Author Commented:
I think that's the issue.  
The older files had one extra root element at the beginning:
<xts:sports-content-set>
</xts:sports-content-set>
The new one doesn't have that.

I made the following change and I think it works now:
From:  
foreach ($obj->{"sports-content"}->schedule->{"sports-event"} as $game_data)
To:
foreach ($obj->schedule->{"sports-event"} as $game_data)
0
dsg138Author Commented:
Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
XML

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.