5){$itemcnt=5;} } function EndHandler2($parser, $name) { global $buffer,$itemcnt,$data; $buffer = mb_convert_encoding($buffer,"UTF-8","auto"); switch($name){ case "title":$data['title'][$itemcnt]=$buffer;break; case "link":$data['url'][$itemcnt]=$buffer;break; case "description":$data['desc'][$itemcnt]=$buffer;break; case "dc:date":$data['date'][$itemcnt]=substr( $buffer, 1, 14 );break; default : break; } $buffer=""; } $parser=xml_parser_create(); xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,false); xml_set_element_handler($parser,"StartHandler2","EndHandler2"); xml_set_character_data_handler($parser,"CharacterHandler2"); $fp = fopen('http://k2print.jugem.jp/index.rdf','r'); while($strbuf=fread($fp,3000)){ xml_parse($parser,$strbuf,feof($fp)); } fclose($fp); xml_parser_free($parser); for($j=1;$j<=$itemcnt;$j++){ //for($j=1;$j<=1;$j++){ echo "{$data['date'][$j]} :
{$data['title'][$j]}
"; } ?>