Google AJAX Search APIをPHPから使う方法
ご丁寧にも公式ドキュメントに方法は書かれている。
http://code.google.com/intl/ja/apis/ajaxsearch/documentation/#fonje
ところが自分はcURLというものをよく理解していないので file_get_contents でデータを取得している。とりあえず問題は起こっていない。
$url = "http://ajax.googleapis.com/ajax/services/search/news?v=1.0&key=YOUR-API-KEY&hl=ja&q=" . rawurlencode($query); $jsondata = file_get_contents($url); $news = json_decode($jsondata); print_r($news); // Google Newsのデータを取得出来ている