$feedURL = 'http://########.tumblr.com/api/read/';
$xml = simplexml_load_file($feedURL);
foreach($xml->posts->post as $post){
$posts = (string) $post->{'photo-caption'};
$img = (string) $post->{'photo-url'};
echo "<div style='width:518px;height:300px;'><div style='width:200px;height:200px;float:left;'>".'<img style="width:200px;height:200px;" src="' . $img . '" />'."</div><div style='width:300px;float:right;'>".$posts."</div></div><br>";
}
I have used this code to display all the available posts, but i want to display just first five posts
According to the tumblr API, you can append a querystring parameter
numto limit the number of posts returned from the API call. I have no personal experience with the Tumblr API, but you might try something like this to limit the number of posts read: