php - Foreach xml server response -
i have questions foreach
. request curl
, receive response in xml
like:
<hotellist> <hotelsummary id=848484> <hotel>prova</hotel> <address>via bho</address> <thumbnailurl>/hotels/1000000/530000/526200/526198/526198_38_t.jpg</thumbnailurl> </hotelsummary> </hotellist>
how can change every
<thumbnailurl>/hotels/1000000/530000/526200/526198/526198_38_t.jpg</thumbnailurl>
to
<img src="$$server$$/hotels/1000000/530000/526200/526198/526198_38_t.jpg>
is possible foreach
?
you mean like:
$xmlobj = simplexml_load_string($your_xml_response); foreach($xmlobj->hotelsummary $hotel) { $imgsrc = "$$server$$" . $hotel->thumbnailurl; }
Comments
Post a Comment