Skip to content

Instantly share code, notes, and snippets.

@blockworks
Created August 20, 2011 13:24
Show Gist options
  • Save blockworks/1159105 to your computer and use it in GitHub Desktop.
Save blockworks/1159105 to your computer and use it in GitHub Desktop.
SimpleXMLのメモ
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>テスト</title>
</head>
<body>
<?php
$url = "http://b.hatena.ne.jp/hotentry.rss";
$str = file_get_contents( $url );
$simplexml = simplexml_load_string( $str );
$i = count( $simplexml->item );
while( $i-- ){
echo "<p>". $simplexml->item[$i]->hatena->bookmarkcount = $simplexml->item[$i]->children("hatena", true)->bookmarkcount . "</p>";
}
echo "<hr><pre>";
var_dump ($simplexml);
echo "</pre>";
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment