Example #1
0
 protected function friends()
 {
     $c = $this->getConfig();
     $o = new WeiboClient($c['WB_AKEY'], $c['WB_SKEY'], $_SESSION['last_key']['oauth_token'], $_SESSION['last_key']['oauth_token_secret']);
     $r = $o->friends();
     //dump($r);exit;
     return $r;
 }
Example #2
0
include_once 'config.php';
include_once 'weibooauth.php';
include_once dirname(__FILE__) . '/../zmysqlConn.class.php';
include_once "expkits.inc.php";
$c = new WeiboClient(WB_AKEY, WB_SKEY, LAST_OAUTH_TOKEN, LAST_OAUTH_TOKEN_SECRET);
$zconn = new zmysqlConn();
$uid = -1;
if ($argc >= 2) {
    $uid = $argv[1];
} else {
    $sql = "select * from weibo_users order by weeklylikes-weeklydislikes desc limit 1";
    $rs = mysql_query($sql, $zconn->dblink);
    $r = mysql_fetch_assoc($rs);
    $uid = $r['uid'];
}
$friends = $c->friends(false, 100, $uid);
//var_dump($friends);//for debug
//exit("\n");//for debug
/*
 * get the totals before insert / update.
 */
$sql = "select count(id) from weibo_users";
$rs = mysql_query($sql, $zconn->dblink);
$r = mysql_fetch_row($rs);
$foretotals = $r[0];
$i = $j = $f = 0;
if ($friends != null && !array_key_exists("error", $friends)) {
    foreach ($friends as $friend) {
        /*
         * we only gather the female ones and their followers 
         * must not be over 100000.