json死闘編
PHP5.3.3なので、json形式はPHP-jsonかPEAR入れないと動かない。。。
function Get_TL($type,$sid = null,$count = 30){ $opt = array(); $opt['count'] = $count; if($sid){$opt['since_id'] = $sid;} $req = $this->Request("statuses/".$type.".json","GET",$opt); // JSON形式の方がちょっと扱いやすい if($req){ if($req->Code != "200"){die("Error2: ".$req->Code);} $result = str_replace(":NULL,",':"NULL",',$req->Body); } else {die('Get_TL(): $req is NULL');} $result = json_decode($result); if($result->error){die($result->error);} return array_reverse($result); }
どうやったらjson形式以外にできるのか。。
追追記
これは改行コードだけの問題ですかね。。
XMLの扱いを勉強しなくては。。
Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Start tag expected, '<' not found in /usr/local/www/htdocs/fk2000/public_html/php/PEAR/Services/Twitter.php on line 598 Warning: simplexml_load_string() [function.simplexml-load-string]: u'^A^L in /usr/local/www/htdocs/fk2000/public_html/php/PEAR/Services/Twitter.php on line 598 Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in /usr/local/www/htdocs/fk2000/public_html/php/PEAR/Services/Twitter.php on line 598 Warning: Invalid argument supplied for foreach() in /usr/local/www/htdocs/fk2000/public_html/php/PEAR/Services/Twitter.php on line 606 Unsupported endpoint statuses