Scribd的API返回XML,例如:
<?xml version="1.0" encoding="UTF-8"?><rsp stat="ok"><thumbnail_url>http://imgv2-4.scribdassets.com/img/word_document/60906103/111x142/79c5e6bab7/1327030759</thumbnail_url></rsp>
有没有办法快速,比如用一两行来获取thumbnail_url
的内容,即http://imgv2-4.scribdassets.com/img/word_document/60906103/111x142/79c5e6bab7/1327030759
?
答案 0 :(得分:4)
$xml = simplexml_load_string($string_data);
$url = (string) $xml->thumbnail_url;