Googleトレンド、Yahoo!検索ランキング、gooキーワードランキング、twitterのつぶやきのランキングを取得してみます。
Googleトレンド
<?php
$url = "http://www.google.co.jp/m/services/trends/get";
$xml = simplexml_load_file($url);
if($xml){
foreach($xml->item as $item){
// $item->query がタイトル
// $item->snippet が説明
// $item->landing_page["url"] がURLです
}
}
?>
Yahoo!検索ランキング
<?php
$url = "http://searchranking.yahoo.co.jp/rss/burst_ranking-rss.xml";
$xml = simplexml_load_file($url);
if($xml){
foreach($xml->channel->item as $item){
// $item->title がタイトル
// $item->description が説明
// $item->link がURLです
}
}
?>
gooキーワードランキング
<?php
$url = "http://ranking.goo.ne.jp/rss/keyword/keyrank_all1/index.rdf";
$xml = simplexml_load_file($url);
if($xml){
foreach($xml->item as $item){
// $item->title がタイトル
// $item->link が説明です
}
}
?>
https://api.twitter.com/1/trends/available.json
<?php
$url = "https://api.twitter.com/1/trends/23424856.json";
$json = file_get_contents($url);
$decode = json_decode($json, true);
if($decode){
foreach($decode[0]["trends"] as $item){
// $item["name"] がタイトル
// $item["url"] がURLです
}
}
?>






