I am learning PHP and need to know how to get the elements in following XML API into an Array. I tried with simplexml_load_file() function. But it gave me an error.
Here are my code.
<?php $xml=simplexml_load_file("http://static.cricinfo.com/rss/livescores.xml"); foreach($xml->getElementsByTagName('item') as $match) { echo $match->getAttribute('title'), "\n"; } ?>
No comments:
Post a Comment