21,882
社区成员
发帖
与我相关
我的任务
分享
//闲着无聊,随便弄了弄,将就着用吧
$apiurl='http://api.douban.com/book/subject/3921815';
$Feed = file_get_contents($apiurl);
$p = xml_parser_create();
xml_parse_into_struct($p, $Feed, $vals, $index);
print_r($vals);
/*
Array
(
//省略部分。。。。
[60] => Array
(
[tag] => GD:RATING
[type] => complete
[level] => 2
[attributes] => Array
(
[AVERAGE] => 8.5
[MAX] => 10
[MIN] => 0
[NUMRATERS] => 195
)
)
[61] => Array
(
[tag] => ENTRY
[value] =>
[type] => cdata
[level] => 1
)
[62] => Array
(
[tag] => ENTRY
[type] => close
[level] => 1
)
)
*/
$apiurl='http://api.douban.com/book/subject/3921815';
$Feed = file_get_contents($apiurl);
preg_match('#<gd:rating average="(.*)" max="10" min="0" numRaters="(\d+)"/>#s',$Feed,$arr);
print_r($arr);
$apiurl='http://api.douban.com/book/subject/3921815';
$Feed = file_get_contents($apiurl);
preg_match('#<gd:rating average="(.*)" max="10" min="0" numRaters="(\d+)"/>#s',$Feed,$arr);
print_r($arr);
$apiurl='http://api.douban.com/book/subject/3921815';
$Feed = file_get_contents($apiurl);
preg_match('#<gd:rating average="(.*)" max="10" min="0" numRaters="(\d+)"/>#s',$Feed,$arr);
print_r($arr);