Skip to content

Instantly share code, notes, and snippets.

@halka
Created April 11, 2009 06:21
Show Gist options
  • Save halka/93479 to your computer and use it in GitHub Desktop.
Save halka/93479 to your computer and use it in GitHub Desktop.
DOS窓から好きなユーザのログをがしがし取る
<?php
$user=$argv[1];
$count=$argv[2];
$got=0;
$f=false;
for($i=1;$i<=$count;$i++){
$url="http://twitter.com/statuses/user_timeline/$user.json?page=$i";
$file=@file_get_contents($url);
if($file){
$temp=json_decode($file,true);
if(!$f){
echo "name : ".mb_convert_encoding($temp[0]['user']['name'],'SJIS','AUTO')."\n";
echo "location : ".mb_convert_encoding($temp[0]['user']['location'],'SJIS','AUTO')."\n";
echo "description : ".mb_convert_encoding($temp[0]['user']['description'],'SJIS','AUTO')."\n";
echo "followes : ".$temp[0]['user']['followers_count']."\n";
echo "url : ".$temp[0]['user']['url']."\n\n";
}
$f=true;
foreach($temp as $nakami){
//echo $nakami['text']."\n";
echo mb_convert_encoding($nakami['text'],"SJIS","UTF-8")."\n";
//echo "(".date("Y/m/d H:i:s",strtotime($nakami['created_at'])+9*3600).")".$nakami['id']."\n\n";
echo "(".$nakami['created_at'].") ".$nakami['id']." ".mb_convert_encoding(strip_tags($nakami['source']),"SJIS","UTF-8")."\n\n";
$got++;
}
}
}
if($got!=0) echo $got;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment