Created
August 20, 2011 13:24
-
-
Save blockworks/1159105 to your computer and use it in GitHub Desktop.
SimpleXMLのメモ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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