The second step, if the file is present, once you have tweaked what will be uploaded to your satisfaction, will be to upload the posts to Tumblr. I don't try to manually detect video links; you'll have to go through the uploads file yourself and add those in manually. For reference from , the possible data you can send are: regular - Requires at least one: title body (HTML allowed) photo - Requires either source or data, but not both. If both are specified, source is used. source - The URL of the photo to copy. This must be a web-accessible URL, not a local file or intranet location. data - An image file. See File uploads below. caption (optional, HTML allowed) click-through-url (optional) quote quote source (optional, HTML allowed) link name (optional) url description (optional, HTML allowed) conversation title (optional) conversation video - Requires either embed or data, but not both. embed - Either the complete HTML code to embed the video, or the URL of a YouTube video page. data - A video file for a Vimeo upload. See File uploads below. title (optional) - Only applies to Vimeo uploads. caption (optional, HTML allowed) audio data - An audio file. Must be MP3 or AIFF format. See File uploads below. externally-hosted-url (optional, replaces data) - Create a post that uses this externally hosted audio-file URL instead of having Tumblr copy and host an uploaded file. Must be MP3 format. No size or duration limits are imposed on externally hosted files. caption (optional, HTML allowed) */ $gReader = 'averylongnumber'; $email = 'me@example.com'; $password= 'ahotp4assphras3withpunctuat!onihope'; function encode($dat, $padd) { $rv = ''; if (is_array($dat)) { $rv .= $padd."{"; $first = ''; foreach ($dat as $key=>$val) { $rv .= $first."\n".$padd.' '.encode($key, $padd.' ').' : '.encode($val, $padd.' '); $first = ','; } $rv .= "\n".$padd."}\n"; } else $rv .= json_encode($dat); return $rv; } $data = @file_get_contents('GReader.json'); if ($data === false) { echo "Did not find a file called GReader.json. Creating it for you to edit before it is uploaded.\n"; $url = "http://www.google.com/reader/public/atom/user%2F$gReader%2Fstate%2Fcom.google%2Fbroadcast"; $continuation = ''; $data = FALSE; do { $curURL = $url.($continuation != '' ? "?c=$continuation" : ''); $curl = curl_init($curURL); curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); $rv = curl_exec($curl); if ($rv === false || curl_errno($curl)) { echo "Failed to load $curURL. Aborting.\n"; return; } curl_close($curl); $doc = DOMDocument::loadXML($rv); if ($doc === FALSE) { echo "Google gave us some malformed XML at $curURL. What!?! Aborting.\n"; return; } if ($data === FALSE) $data = $doc; else { $newDoc = $data->importNode($doc->documentElement, true); while ($newDoc->hasChildNodes()) $data->documentElement->appendChild($newDoc->firstChild); } preg_match('/continuation>([^>]*)<\//', $rv, $continuation); //Lazy; sorry. $continuation = @$continuation[1]; } while ($continuation != ''); $data = simplexml_import_dom($data); $dats = array(); foreach ($data->entry as $ent) { $ent->registerXPathNamespace('atom', "http://www.w3.org/2005/Atom"); $link = $ent->xpath('atom:link[@rel=\'alternate\']'); $ent->registerXPathNamespace('gr', 'http://www.google.com/schemas/reader/atom/'); $annot = $ent->xpath('gr:annotation'); if ((string)$link[0]['href'] == '') $arr = array( 'type' => 'regular', 'date' => (string)$ent->published, 'title' => (string)$ent->title->asXML(), 'body' => preg_replace('/^(]*>\s*)?<[^>]*>|<[^>]*>$/', '', $ent->content->asXML()) ); else $arr = array( 'type' => 'link', 'date' => (string)$ent->published, 'url' => (string)$link[0]['href'], 'name' => (string)$ent->title ); if (count($annot) > 0 && $arr['type'] == 'link') $arr['description'] = preg_replace('/^(]*>\s*)?<[^>]*>|<[^>]*>$/', '', $annot[0]->content->asXML()); $dats[] = $arr; } $encoded = encode($dats, ''); if (file_put_contents('GReader.json', $encoded) === false) { echo PHP_EOL.PHP_EOL.$encoded. "\nCould not save file. Please put the above data in a file 'GReader.json' and tweak it to contain what you want to upload.\n"; } else { echo "Done. Check the file and then run the tool a second time.\n"; } return; } $dats = json_decode($data, true); echo "Uploading data from 'GReader.json'\n"; $rejects = array(); foreach($dats as $ent) { $opts = array_merge($ent, array( 'email' => $email, 'password' => $password, 'generator' => 'GReader imports', 'format' => 'html', 'send-to-twitter' => 'no')); $curl = curl_init('http://www.tumblr.com/api/write'); curl_setopt($curl, CURLOPT_POST, TRUE); curl_setopt($curl, CURLOPT_POSTFIELDS, $opts); curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); $rv = curl_exec($curl); if ($rv === false || curl_getinfo($curl, CURLINFO_HTTP_CODE) != '201') { $rejects[] = $opts; } curl_close($curl); echo '.'; usleep(700);//Avoid rate limit. } echo "\n"; if (count($rejects) > 0) { echo "Done uploading. Some posts failed to upload."; $encoded = encode($rejects, ''); if (file_put_contents('rejects.json', $encoded) === false) { echo "\n\n$encoded\n\nThe above data failed to be uploaded.\n"; } else { echo " The rejected posts were saved in 'rejects.json'.\n"; } } else echo "All done!\n"; ?>