Select specific Tumblr XML values with PHP

john0090

New Member
My goal is to embed Tumblr posts into a website using their provided XML. The problem is that Tumblr saves 6 different sizes of each image you post. My code below will get the first image, but it happens to be too large. How can I select one of the smaller-sized photos out of the XML if all the photos have the same tag of \[code\]<photo-url>\[/code\]? → This is the XML from my Tumblr that I'm using: Tumblr XML.→ This is my PHP code so far:\[code\]<?php$request_url = "http://kthornbloom.tumblr.com/api/read?type=photo";$xml = simplexml_load_file($request_url);$title = $xml->posts->post->{'photo-caption'};$photo = $xml->posts->post->{'photo-url'};echo '<h1>'.$title.'</h1>';echo '<img src="'.$photo.'"/>"'; echo "
 
Back
Top