I implemented the following code based on some code that I found in another question:
Select specific XML Tumblr values ββusing PHP
function getPhoto($photos, $desiredWidth) { $currentPhoto = NULL; $currentDelta = PHP_INT_MAX; foreach ($photos as $photo) { $delta = abs($desiredWidth - $photo['max-width']); if ($photo['max-width'] <= $desiredWidth && $delta < $currentDelta) { $currentPhoto = $photo; $currentDelta = $delta; } } return $currentPhoto; } $request_url = "http://ACCOUNT.tumblr.com/api/read?type=photo&start=0&num=30"; //$request_url = "tumblr.xml"; $xml = simplexml_load_file($request_url); foreach ($xml->posts->post as $post) { echo "<div class=\"item\"><a href='".$post['url']."'><img src='".getPhoto($post->{'photo-url'}, 250)."' width=\"250\" /></a></div>"; }
This code worked very well on my development site, but when I clicked it on another server, it did not load the external XML from Tumblr ... It downloaded the local XML text just fine (commented out in the code).
I'm waiting to get credentials from a client, so I can contact support and work with them ...
At the same time, does anyone have any ideas what might cause this?
Server settings?
Missing PHP code?
source share