getOnlineListTotal[0]->onlinetotal; //$limit = 10; $url="http://www.show-live.net/api/api.php?web_id=272&action=getList&limit=".$limit; $contents = file_get_contents($url); $c = json_decode($contents); $rurl="http://www.show-live.net/api/api.php?web_id=272&action=getRank"; $rcontents = file_get_contents($rurl); $rank = json_decode($rcontents); $setzero = sprintf("UPDATE zb SET online='%s'", 0); $zeroResult = mysql_query($setzero, $work_new); for($count=0;$count<$limit;$count++){ $id = $c->getList[$count]->showid; $host = $c->getList[$count]->webhost; $url2="http://www.show-live.net/api/api.php?web_id=272&action=getInfo&webhost=".$host."&showid=".$id; $con = file_get_contents($url2); $inf = json_decode($con); $name = $id.'_b.gif'; $ip = $_SERVER['REMOTE_ADDR']; $urlweb = $_SERVER['HTTP_HOST']; $showid=$inf->getInfo->showid;$showname=$inf->getInfo->showname;$online=$inf->getInfo->online;$onmode=$inf->getInfo->onmode;$webhost=$inf->getInfo->webhost;$totala=$inf->getInfo->totala;$img=$inf->getInfo->img;$cocard_one=$inf->getInfo->cocard_one;$cocard_many=$inf->getInfo->cocard_many;$thw=$inf->getInfo->{'3w'};$cm=$inf->getInfo->cm;$kg=$inf->getInfo->kg;$note=$inf->getInfo->note;$chatroom_url=$inf->getInfo->chatroom_url;$sexy=$inf->getInfo->sexy;$mic=$inf->getInfo->mic;$chinese=$inf->getInfo->chinese;$english=$inf->getInfo->english; $updateSQL = "REPLACE INTO zb (showid,showname,online,onmode,webhost,totala,img,cocard_one,cocard_many,3w,cm,kg,note,chatroom_url,sexy,mic,chinese,english,ip,urlweb) VALUES ('$showid','$showname','$online','$onmode','$webhost','$totala','$img','$cocard_one','$cocard_many','$thw','$cm','$kg','$note','$chatroom_url','$sexy','$mic','$chinese','$english','$ip','$urlweb')"; $udsResult = mysql_query($updateSQL, $work_new); $rid = $rank->getRank[$count]->showid; $rupdateSQL = "REPLACE INTO rank (id,showid) VALUES ('$count','$rid')"; $udrResult = mysql_query($rupdateSQL, $work_new); if(!file_exists($name)){ $image = $inf->getInfo->img; $image2 = "存取中"; $f=fopen($image,'rb'); $dis = '/home/www2cctel/img/'; $name = $id.'_b.gif'; $f2=fopen($dis.$name,'wb'); while(!feof($f)){ fputs($f2,fgetc($f)); } fclose($f); fclose($f2); } } echo date("Y-m-d H:i:s"); ?>