//トレンドキーワードをAPIからとってくる
<!DOCTYPE html>
<?php
// [$xml]にデータを取得する
$xml = @file_get_contents( "http://kizasi.jp/kizapi.py?type=rank" ) ;
// XMLをオブジェクト形式に変換する [処理用]
$obj = @simplexml_load_string( $xml ) ;
// オブジェクト形式をJSONに変換する [保存用]
$json = json_encode( $obj ) ;
// トレンドワードをランキング形式で出力する
echo "
- " ;
- " . (string)$item->title . " " ;
// オブジェクトに変換したデータをループ処理
foreach( $obj->channel->item as $item )
{
echo "
}
echo "
?>