SaeTClientV2::friends_by_id PHP Method

friends_by_id() public method

如果没有提供cursor参数,将只返回最前面的5000个关注id
对应API:{@link http://open.weibo.com/wiki/2/friendships/friends friendships/friends}
public friends_by_id ( integer $uid, integer $cursor, integer $count = 50 ) : array
$uid integer 要获取的用户的ID。
$cursor integer 返回结果的游标,下一页用返回值里的next_cursor,上一页用previous_cursor,默认为0。
$count integer 单页返回的记录条数,默认为50,最大不超过200。
return array
    function friends_by_id($uid, $cursor = 0, $count = 50)
    {
        $params = array();
        $params['cursor'] = $cursor;
        $params['count'] = $count;
        $params['uid'] = $uid;
        return $this->oauth->get('friendships/friends', $params);
    }

Usage Example

Ejemplo n.º 1
0
     if (1 != $num) {
         $msg = "向数据库插入数据出错。file:" . __FILE__ . ";line:" . __LINE__ . "sql:" . $sql;
         debug($msg);
     }
     $sql = "update user set bind_status = bind_status + 1 where user_id = '{$id}' limit 1";
     $num = $dbo->exeUpdate($sql);
     if (1 != $num) {
         $msg = "向数据库插入数据出错。file:" . __FILE__ . ";line:" . __LINE__ . "sql:" . $sql;
         debug($msg);
     }
     //写session,跳转
     $_SESSION['sid'] = $sid;
     $_SESSION['stoken'] = $token['access_token'];
     header("Location:task.php");
     // 后台获取用户的已关注用户id列表,写入SESSION
     $friends = $c->friends_by_id($_SESSION['sid']);
     if_weiboapi_fail($friends, __FILE__, __LINE__);
     foreach ($friends['users'] as $friend) {
         $followed_id[] = $friend['id'];
     }
     $_SESSION['followed_id'] = $followed_id;
     $_SESSION['is_bind_weibo'] = TRUE;
     $_SESSION['slevel'] = $weibo_init_level;
     exit;
 } else {
     // 尚未注册。在用微博帐号注册。注:直接用微博注册者默认为普通会员,广告主需要先注册微动力。
     $user_info = $c->show_user_by_id($sid);
     // fetch user basic message according to sid
     if_weiboapi_fail($user_info);
     $screen_name = $user_info['screen_name'];
     $name = $screen_name . '@sina';
All Usage Examples Of SaeTClientV2::friends_by_id
SaeTClientV2