Getting XML attributes in PHP
问题 Looked at a few other SO posts on this but no joy. I've got this code: $url = "http://itunes.apple.com/us/rss/toppaidapplications/limit=10/genre=6014/xml"; $string = file_get_contents($url); $string = preg_replace("/(<\/?)(\w+):([^>]*>)/", "$1$2$3", $string); $xml = simplexml_load_string($string); foreach ($xml->entry as $val) { echo "RESULTS: " . $val->attributes() . "\n"; but I can't get any results. I'm specifically interested in getting the ID value which would be 549592189 in this