TumblrをXMLで読み込む
とりあえずテキストのタイトルを読み出してみました
$contents = file_get_contents('http://osamuya.tumblr.com/api/read');
$xml = simplexml_load_string( $contents, 'SimpleXMLElement', LIBXML_NOCDATA ) or die("パースエラー");
#echo $xml['version']."
\n";
#array_reverse($xml->posts->post);
foreach ($xml->posts->post as $post) {
foreach($post->attributes() as $a => $b) {
if ($a=='url') {
$url = $b;
if ($post->{"regular-title"}) {
echo "- ".$post->{"regular-title"}."
\n";
}
}
}
}
/*
foreach ($xml->posts->post as $title) {
if ($title->{"regular-title"}) {
echo "- ".$title->{"regular-title"}."
\n";
}
}
*/
#var_dump($xml);
?>