1
0

More than 5 years have passed since last update.

kizasi_APIの使い方

Posted at

//トレンドキーワードを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 "

    " ;

    // オブジェクトに変換したデータをループ処理
    foreach( $obj->channel->item as $item )
    {
    echo "

  1. " . (string)$item->title . "
  2. " ;
    }

    echo "

" ;
?>


1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0