ふと思い立ったので調べてみたらとても簡単だった。
簡単なのはPHPだからってのもあるかな。
でもAPIコールするとレスポンスは結構重めなんで、乱発はイクナイっぽい。
$word = urlencode("ツイッター");
$f = file_get_contents("http://search.twitter.com/search.json?q=".$word."&lang=ja&rpp=100");
if ($f === false) die("エラー");
$json = json_decode($f, true);
foreach ($json["results"] as $result) {
echo "<img src=\"".$result["profile_image_url"]."\" />";
echo $result["from_user"];
echo "<br />";
echo $result["text"];
echo "<hr />";
}
Comments are closed.