Jump to content

XML Parsing problem from Tumblr


Andrew777

Recommended Posts

Can some please help me figure out why this isn't working?

 

Just trying to show a page on my site show photo posts from a tumblr account.

So I found this code to pull the XML data and then echo it on my page...

Here is the code but I'm just getting nothing...

 

<?php
    $request_url = "http://alexishoustonmusic.tumblr.com/api/read?start=0&num=1&type=text";
    $xml = simplexml_load_file($request_url);
    $post = $xml->posts->post->{‘regular-body’};
    echo '<h1>'.$post.'</h1>';
?>

I see there is a similar post here but that person didn't say how he fixed his problem...

I'm stumped...

Thanks.

Link to comment
Share on other sites

Thanks for your response Requinix.
 

I tried to do the same (below) but still get nothing returned back showing up on the page...

Can you tell why my code below still isn't doing anything?

<?php
    $request_url = "http://alexishoustonmusic.tumblr.com/api/read?start=0&num=1&type=text";
    $xml = simplexml_load_file($request_url);
    $post = $xml->posts->post->{"regular-body"};
    echo "<h1>".$post."</h1>";
?>
Link to comment
Share on other sites

Requinix: I will check on the error reporting to see if that helps thanks.

Boompa: I have looked at the Tumblr api and it's beyond my scope i guess, cause i don't get it.

xenLiam: I still get nothing on my page even though my code is still the same as you show in your screen shot...

 

This sucks, i may have to hire someone just to do this.....

Link to comment
Share on other sites

What are you expecting to show anyway?

 

If you wanted to show each post with pictures then your url is wrong, because it only returns a single text

Use the default one, then try parsing each element

http://alexishoustonmusic.tumblr.com/api/read
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.