<?php
$url = 'http://api.soundcloud.com/tracks';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$body = curl_exec($ch);
curl_close($ch);
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parse_into_struct($parser, $body, $data);
xml_parser_free($parser);
print "<h1>The XML as a relatively flat PHP data structure</h1>";
print "<pre>";
print htmlentities($body);
print "</pre>";
print "<hr />";
print "<h1>The Raw XML Data</h1>";
print "<pre>";
print htmlentities(print_r($data, true));
print "</pre>";
print "<pre>";
?>
感謝這將是非常感謝fule對我整合api – rajanikant 2010-06-24 04:53:01