Search code examples
phpapifile-get-contentstumblr

Tumblr API file_get_contents


I'm trying to use Tumblr API I believe its JSON. I'm trying to get the "posts-total" in the URL below using Php and echo it out. How would I do this?

http://example.tumblr.com/api/read/json?num=0

Thank you

Update:

I trying to use

$result = json_decode(file_get_contents('http://example.tumblr.com/api/read/json?num=0'));
$print_r($result); 
echo $result[1]; 

I'm getting a 500 error. When I just try to echo out $result I get nothing.


Solution

  • Simple php-

    $result = json_decode(file_get_contents('http://example.tumblr.com/api/read/json?num=0'));
    print_r($result); //will show contents return in an araay format
    echo $result[1]; //or whatever the element is