jonccrawley Posted August 11, 2011 Share Posted August 11, 2011 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’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 Quote Link to comment https://forums.phpfreaks.com/topic/244507-getting-xml-information/ Share on other sites More sharing options...
jonccrawley Posted August 11, 2011 Author Share Posted August 11, 2011 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> Quote Link to comment https://forums.phpfreaks.com/topic/244507-getting-xml-information/#findComment-1255978 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.