Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Erase all your posts from your Tumblr account
<?php
// ------WARNING------
// RUNNING THIS FILE WITH THE APPROPRIATE CREDENTIALS WILL
// ERASE ALL YOUR POSTS FROM YOUR TUMBLR BLOG!
// Tumblr Blog Info
//replace YOUR-TUMBLR-EMAIL with the email you are using to login to Tumblr
$tumblrEmail = 'YOUR-TUMBLR-EMAIL';
//replace YOUR-TUMBLR-PASSWORD with the password you enter when logging in Tumblr
$tumblrPassword = 'YOUR-TUMBLR-PASSWORD';
//replace YOUR-TUMBLR-DOMAIN with the subdomain of the tumblr url you are using
// e.g. if your Tumblr blog is at http://lala.tumblr.com, then
// replace YOUR-TUMBLR-DOMAIN with lala
$tumblrDomain = 'YOUR-TUMBLR-DOMAIN';
$i = 0;
do {
$xml = simplexml_load_file("http://" . $tumblrDomain . ".tumblr.com/api/read?start=" . $i . "&num=50&rand=" . rand());
$i += 50;
$count = count($xml->posts->post);
if($count == 0)
break;
foreach($xml->posts->post as $post) {
$postId = (string)$post[id];
echo $postId . "\n";
$requestData = http_build_query(
array(
'email' => $tumblrEmail,
'password' => $tumblrPassword,
'post-id' => $postId,
'generator' => 'API example'
)
);
// Send the POST request (with cURL)
$c = curl_init('http://www.tumblr.com/api/delete');
curl_setopt($c, CURLOPT_POST, true);
curl_setopt($c, CURLOPT_POSTFIELDS, $requestData);
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($c);
$status = curl_getinfo($c, CURLINFO_HTTP_CODE);
curl_close($c);
// Check for success
if ($status == 403)
echo "Bad email or password\n";
else
echo $result . "\n";
}
} while($count > 0);
?>
@georgemiler
Copy link

not is working, error not found

@georgemiler
Copy link

Hello, I tried and tried, but not working, appears an error of not found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment