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);
?>