quickly extract the contents of an xml tag in php

108 Views Asked by At

Scribd's API returns XML, for example:

<?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>

is there a way to quickly, say in one or two lines, get the contents of thumbnail_url, that is http://imgv2-4.scribdassets.com/img/word_document/60906103/111x142/79c5e6bab7/1327030759?

1

There are 1 best solutions below

3
On BEST ANSWER
$xml = simplexml_load_string($string_data);
$url = (string) $xml->thumbnail_url;