Andrew777 Posted May 31, 2013 Share Posted May 31, 2013 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. Quote Link to comment Share on other sites More sharing options...
Andrew777 Posted May 31, 2013 Author Share Posted May 31, 2013 Am i the only person who doesn't get any replies to my question? 50 Views and no one knows how to solve this issue? Quote Link to comment Share on other sites More sharing options...
requinix Posted May 31, 2013 Share Posted May 31, 2013 After fixing the smart quotes, your code works fine for me. Although it outputs as ... which is unusual (but not invalid) markup. Quote Link to comment Share on other sites More sharing options...
Andrew777 Posted June 1, 2013 Author Share Posted June 1, 2013 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>"; ?> Quote Link to comment Share on other sites More sharing options...
requinix Posted June 1, 2013 Share Posted June 1, 2013 Nope. Still works for me. Do you have display_errors=on and error_reporting=-1 in your php.ini? Try with those and see if there are any error messages. Quote Link to comment Share on other sites More sharing options...
boompa Posted June 1, 2013 Share Posted June 1, 2013 You'd likely have a much easier time of it using the Tumblr API. Quote Link to comment Share on other sites More sharing options...
xenLiam Posted June 1, 2013 Share Posted June 1, 2013 Same result, it works for me. http://screencloud.net/v/b6lk Quote Link to comment Share on other sites More sharing options...
Andrew777 Posted June 2, 2013 Author Share Posted June 2, 2013 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..... Quote Link to comment Share on other sites More sharing options...
xenLiam Posted June 2, 2013 Share Posted June 2, 2013 (edited) Edit php.ini and make sure display_errors is on. Restart your web server afterwards. Edited June 2, 2013 by xenLiam Quote Link to comment Share on other sites More sharing options...
Eiseth Posted June 2, 2013 Share Posted June 2, 2013 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 Quote Link to comment 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.