Search the Community
Showing results for tags 'tumblr'.
-
Hello fine peoples of phpfreaks. I have a site called Themelr.com. It is basically a Tumblr Theme Generator for Tumblr.com My goal is to automatically update a persons Tumblr blog with the HTML they generate from our site. However it seems to be a little tricky. Here is an example: http://themelr.com/edit/ This page is logging in to Tumblr via cURL. The "custom_theme" JSON is the themes current HTML. How do I decode/extract that and submit to Tumblr a newly provided HTML? tl;dr I am trying to $_POST to tumblr new HTML for their blog. Any ideas?
-
I'm working through some code to display a tumblr blog on a website. Each of Tumblr's post types are easy enough to get to... <ul id="reblog"> <? foreach ($xml->posts->post as $post) { ?> <li> <? // REGULAR POSTS if ($post['type'] == "regular" ){ echo "This is a regular post"; } // PHOTO POSTS if ($post['type'] == "photo" ){ echo "This is a photo post"; } // LINK POSTS if ($post['type'] == "link" ){ echo "This is a link post"; } // AUDIO POSTS if ($post['type'] == "audio" ){ echo "This is an audio post"; } ?> </li> <? } ?> </ul> What I'm trying to do is to check and see if certain tags are used on a post, and the based on that I'll be formatting the entry a little different. I can list all of the tags, but I'm stumped on how to check the existence of a certain tag in $post->{'tag'} $xml = simplexml_load_file('http://applesold.com/assets/cache/tumblrposts.txt'); <ul id="reblog"> <? foreach ($xml->posts->post as $post) { ?> <li> <? // REGULAR POSTS if ($post['type'] == "regular" ){ echo "type of post: regular<br>"; // THIS DOESN'T WORK -- if ($post->{'tag'} == "infographic") { echo "INFOGRAPHIC"; } else { echo "non-INFOGRAPHIC"; } } ?> </li> <? } ?> </ul>
-
I am trying to include the latest post from a tumblr blog in my website, which works fine. I can't figure out how to choose a specific size of photo from the API, such as the 500px photo. <?php $numPosts = 3; $feedURL = "http://jeffhui.tumblr.com/api/read/?num=$numPosts"; $xml = simplexml_load_file($feedURL); foreach($xml->posts->post as $post){ $title = (string) $post->{'regular-title'}; $posts = (string) $post->{'regular-body'}; $photo = (string) $post->{'photo-url'}; $caption = (string) $post->{'photo-caption'}; echo"<h2>".$title."</h2> <p>".$posts."</p> <p><img src=".$photo."></p> <p>".$caption."</p>"; } ?> Some one posted this online and say it has to loop through them like this, but I dont know how to apply the bellow script into my. <?php $xmlResult = file_get_contents($tumblr_url_aktuell); $xml = simplexml_load_file($tumblr_url_aktuell); foreach($xml->posts->post->{'photo-url'} as $photoURL){ if((string)$photoURL['max-width'] == '500'){ $image = $photoURL; } } ?>
-
Hi PHP expert, I am trying to read the post date from my tumblr api with the following code. $date = $xml->posts->post ['date']; echo '<p>'.$date.'</p>'; This is what I get from the above code "Wed, 21 Nov 2012 13:32:00" My question is, are there anyways I can get the date with out the hour, min and seconds? for example "Wed,21 Nov 2012"?
-
Is it possible for a site to block cURL? Here's my code that was working about a month ago: <?php $tumblr_email = 'user@user.com'; $tumblr_password = 'pass'; $request_data = http_build_query( array( 'email' => $tumblr_email, 'password' => $tumblr_password ) ); $c1 = curl_init('http://www.tumblr.com/login'); curl_setopt($c1, CURLOPT_POST, true); curl_setopt($c1, CURLOPT_POSTFIELDS, $request_data); curl_setopt($c1, CURLOPT_RETURNTRANSFER, true); curl_setopt($c1, CURL_COOKIEFILE, 'cookie.txt'); curl_setopt($c1, CURLOPT_COOKIEJAR, 'cookie.txt'); curl_setopt($c1, CURLOPT_FOLLOWLOCATION,true); $result1 = curl_exec($c1); echo $result1; curl_close($c1); ?>