Jump to content

Getting XML information


jonccrawley

Recommended Posts

Hello I am trying to get some specific information from my tumbler account so that i can re post it on my website.

 

This is what i have so far

<body>
        <div class="title">
                <?php
                        $request_url="http://jonccrawley.tumblr.com/api/read?post&start=1&num=1";
                        $xml=simplexml_load_file($request_url);
                        $title=$xml->posts->post->{'regular-title'};
                        echo $title
?>

</div>
        <div class="body">
                <?php
                        $body=$xml->posts->post->{'regular-body'};
                        echo $body;
                ?>
        </div>
<body>

 

And this is a copy of the xml i am trying to get ( http://jonccrawley.tumblr.com/api/read?post&start=1&num=1 )

 

<tumblr version="1.0">
     <tumblelog name="jonccrawley" timezone="US/Eastern" title="Jon C Crawley"/>

        <posts start="1" total="2">

             <post id="8744248203" url="http://jonccrawley.tumblr.com/post/8744248203"         url-with-slug="http://jonccrawley.tumblr.com/post/8744248203/new-project" type="regular" date-gmt="2011-08-10 19:50:12 [b]GMT" date="Wed, 10 Aug 2011 15:50:12"[/b] unix-timestamp="1313005812" format="html" reblog-key="Tyww6zGc" slug="new-project">
                       <regular-title>New Project.</regular-title>

                       <regular-body>
                       <p>Currently developing a website that will utilize linked in/tumbler/twitter/and Facebook.</p>

                        <p>And no nick not selling out with a template I&#8217;ll code it from the ground up <strike></strike></p>
                     </regular-body>
             </post>
      </posts>
</tumblr>

information in the post tag is what i am trying to get like (date/time).

<post id="8744248203" url="http://jonccrawley.tumblr.com/post/8744248203" url-with-slug="http://jonccrawley.tumblr.com/post/8744248203/new-project" type="regular" date-gmt="2011-08-10 19:50:12 [b]GMT" date="Wed, 10 Aug 2011 15:50:12"[/b] unix-timestamp="1313005812" format="html" reblog-key="Tyww6zGc" slug="new-project">
<regular-title>New Project.</regular-title>

 

Is their any way of doing this?

 

thank you for your time,

Jon c crawley

Link to comment
https://forums.phpfreaks.com/topic/244507-getting-xml-information/
Share on other sites

Thx Figured it out

<html>
<body>
        <div class="title">
                <?php
                        $request_url="http://jonccrawley.tumblr.com/api/read?post&start=1&num=1";
                        $xml=simplexml_load_file($request_url);
                        $title=$xml->posts->post->{'regular-title'};
                        echo $title
                ?>
        <div class="postdate">  
                <?php

                        $date=$xml->posts->post['date-gmt'];
                        echo $date;


                ?>
        </div>

</div>
        <div class="body">
                <?php
                        $body=$xml->posts->post->{'regular-body'};
                        echo "";
                        echo $body;
                ?>
        </div>
<body>
</html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.