We help IT Professionals succeed at work.
Get Started

unserialize(): Node no longer exists

hankknight
hankknight asked
on
420 Views
Last Modified: 2012-05-09
Why doesn't this work?
<?php
header('Content-Type: text/plain; charset=UTF-8');
$xml = file_get_contents('http://pastehtml.com/view/19qgkgx.txt');
$s = simplexml_load_string($xml);
$z = serialize($s->ResultSet->Matchup->Trends->Team[0]->TeamTrends);
$q = unserialize($z);
print_r($q);
?>

Open in new window

Another example, same problem:
<pre><?php
$s = unserialize('O:16:"SimpleXMLElement":2:{s:11:"@attributes";a:3:{s:8:"TeamName";s:16:"Seattle Mariners";s:6:"TeamId";s:2:"27";s:8:"Location";s:4:"Away";}s:9:"Last5Game";a:5:{i:0;O:16:"SimpleXMLElement":11:{s:8:"GameDate";s:10:"06/13/2010";s:3:"Day";s:3:"Sun";s:5:"Score";s:1:"4";s:8:"Opponent";s:5:"at SD";s:13:"OpponentScore";s:1:"2";s:6:"Result";s:1:"W";s:9:"MoneyLine";s:4:"-115";s:9:"OverUnder";s:1:"6";s:7:"Starter";s:15:"Felix Hernandez";s:9:"StarterIP";s:4:"8.67";s:15:"OpposingStarter";s:9:"C Richard";}i:1;O:16:"SimpleXMLElement":11:{s:8:"GameDate";s:10:"06/12/2010";s:3:"Day";s:3:"Sat";s:5:"Score";s:1:"1";s:8:"Opponent";s:5:"at SD";s:13:"OpponentScore";s:1:"7";s:6:"Result";s:1:"L";s:9:"MoneyLine";s:3:"105";s:9:"OverUnder";s:1:"6";s:7:"Starter";s:5:"C Lee";s:9:"StarterIP";s:1:"7";s:15:"OpposingStarter";s:9:"W LeBlanc";}i:2;O:16:"SimpleXMLElement":11:{s:8:"GameDate";s:10:"06/11/2010";s:3:"Day";s:3:"Fri";s:5:"Score";s:1:"3";s:8:"Opponent";s:5:"at SD";s:13:"OpponentScore";s:1:"4";s:6:"Result";s:1:"L";s:9:"MoneyLine";s:4:"-140";s:9:"OverUnder";s:3:"6½";s:7:"Starter";s:8:"J Vargas";s:9:"StarterIP";s:1:"6";s:15:"OpposingStarter";s:9:"K Correia";}i:3;O:16:"SimpleXMLElement":11:{s:8:"GameDate";s:10:"06/10/2010";s:3:"Day";s:3:"Thu";s:5:"Score";s:1:"3";s:8:"Opponent";s:6:"at TEX";s:13:"OpponentScore";s:2:"12";s:6:"Result";s:1:"L";s:9:"MoneyLine";s:4:"-210";s:9:"OverUnder";s:2:"10";s:7:"Starter";s:15:"R Rowland-Smith";s:9:"StarterIP";s:4:"5.67";s:15:"OpposingStarter";s:8:"T Hunter";}i:4;O:16:"SimpleXMLElement":11:{s:8:"GameDate";s:10:"06/09/2010";s:3:"Day";s:3:"Wed";s:5:"Score";s:1:"2";s:8:"Opponent";s:6:"at TEX";s:13:"OpponentScore";s:2:"12";s:6:"Result";s:1:"L";s:9:"MoneyLine";s:4:"-210";s:9:"OverUnder";s:3:"9½";s:7:"Starter";s:7:"I Snell";s:9:"StarterIP";s:4:"1.67";s:15:"OpposingStarter";s:11:"C.J. Wilson";}}}');
print_r($s);
?>
</pre>

Open in new window

Comment
Watch Question
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE