friends_by_id() 공개 메소드

如果没有提供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。
리턴 array
예제 #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';
예제 #2
0
        // 0:全部,1:原创,2图片,3视频,4音乐
        $trim_user = 1;
        // 0:返回完整user信息,1:user字段仅返回uid
        $base_app = 0;
        // 0:无限制,1:仅返回通过本应用发布的微博
        $statuses = $c->user_timeline_by_id($uid, $page, $count, $since_id, $max_id, $feature, $trim_user, $base_app);
        if_weiboapi_fail($statuses);
        break;
    case 2:
        // sina_follow
        $uid = $_SESSION['sid'];
        $cursor = 0;
        $count = 50;
        $followers = $c->followers_by_id($uid, $cursor, $count);
        if_weiboapi_fail($followers);
        $friends = $c->friends_by_id($uid, $cursor, $count);
        if_weiboapi_fail($friends);
        break;
    default:
        $msg = '暂不支持该类型';
}
require_once "uiparts/docheader.php";
?>
<body>
	<?php 
include "uiparts/header.php";
?>
	<div id="func_column">
		<ul >
			<li><a href="create_task.php?type=sina_follow">创建新浪关注任务</a></li>
			<li><a href="create_task.php?type=sina_repost">创建新浪转发任务</a></li>
예제 #3
0
  <!--游戏开始按钮div-->
  <div id="daojishi_bot">
    <input name="start_button" type="button" id="start_button" value="开始!" onclick="baoxu_start();" />
  </div>
</div>
<!--用于显示真正进行连连看的图片的TABLE-->
<table id="llk_table" cellspacing="0" cellpadding="0" border="1">
</table>
<!-------------------------连连看模块结束------------------------------->
<!--------------------------用户信息处理-------------------------------->
<?php 
//当前用户的UID
$pre_user_id = $_SESSION['oauth2']["user_id"];
//echo "登记的用户名为:".$pre_user_id;
//获得用户的关注者数组
$friends_info = $c->friends_by_id($uid = $pre_user_id, $cursor = 0, $count = 200);
// done
?>
<div id="user_llk">
  <!--用于显示用户用户的关注者的TABLE-->
  <table id="user_table">
  </table>
  <!--用户控制区,用户选择连连看头像和确定-->
  <div id="user_control">
    <input type="button" value="确定" onclick="chooseUser();" />
    <input type="button" value="换一批" onclick="user_Load(userPhotoArray,userIdArray,userNameArray, userRow, userCol); selectUserRandom(userRow, userCol);" />
  </div>
</div>
<!--获取好友头像,显示以供选取-->
<script language="javascript" type="text/javascript">
var userPhotoArray = [];
예제 #4
0
파일: weibolist.php 프로젝트: robertniu/php
$tlb_byid = $c->timeline_batch_by_id($s);//批量获取指定的一批用户的timeline,测试不成功:第三方应用访问api接口权限受限制 
	if( is_array( $tlb_byid['statuses'] ) )
	{
  		 foreach( $tlb_byid['statuses'] as $item_u )   
   		{      
    		 echo '<div style="padding:10px;margin:5px;border:1px solid #ccc">';
     		 echo '####################################<br>';
     		 echo  $item_u['text'].':<br>';  
                 echo  $item_u['created_at'].'<br>';
                 echo  '</div>';
                }
         }
} 
*/
$f_byid = $c->friends_by_id($targetid, 0, 20);
//根据ID获取用户的关注列表
$sortsid = array();
$i = 0;
if (is_array($f_byid['users'])) {
    foreach ($f_byid['users'] as $item_u) {
        echo '<div style="padding:10px;margin:5px;border:1px solid #ccc">';
        echo '####################################<br>';
        echo $item_u['id'] . '<br>';
        echo $item_u['screen_name'] . ':<br>';
        $ut_byid = $c->user_timeline_by_id($item_u['id'], 1, 1);
        if (is_array($ut_byid['statuses'])) {
            foreach ($ut_byid['statuses'] as $item_c) {
                echo '############<br>';
                // echo 'i='.$i.'<br>';
                echo $item_c['text'] . '<br>';