SaeTClientV2::repost_by_me PHP Method

repost_by_me() public method

对应API:{@link http://open.weibo.com/wiki/2/statuses/repost_by_me statuses/repost_by_me}
public repost_by_me ( integer $page = 1, integer $count = 50, integer $since_id, integer $max_id ) : array
$page integer 返回结果的页码。
$count integer 每次返回的最大记录数,最多返回200条,默认50。可选。
$since_id integer 若指定此参数,则只返回ID比since_id大的记录(比since_id发表时间晚)。可选。
$max_id integer 若指定此参数,则返回ID小于或等于max_id的记录。可选。
return array
    function repost_by_me($page = 1, $count = 50, $since_id = 0, $max_id = 0)
    {
        $params = array();
        if ($since_id) {
            $this->id_format($since_id);
            $params['since_id'] = $since_id;
        }
        if ($max_id) {
            $this->id_format($max_id);
            $params['max_id'] = $max_id;
        }
        return $this->request_with_pager('statuses/repost_by_me', $page, $count, $params);
    }

Usage Example

コード例 #1
0
$sql_res = $dbo->getRs($sql);
$task_weibo_mids = array();
if (0 != count($sql_res)) {
    foreach ($sql_res as $weibo) {
        echo '任务微博 -- ' . $weibo['task_text'] . '。<br />转发产生的mid --  ' . $weibo['repost_mid'] . '</p>';
        $task_weibo_mids[$weibo['task_id']] = $weibo['repost_mid'];
    }
} else {
    echo '<p>我最近没有在微动力上做任务</p>';
}
// 通过api查询当前用户最近转发的微博id
//var_dump($sql_res);
echo '<hr />';
$c = new SaeTClientV2(WB_AKEY, WB_SKEY, $_SESSION['stoken']);
echo '<h3>用新浪api获取我最近转发的微博mid</h3>';
$repost_weibos = $c->repost_by_me(1, 9, 3430446513991533);
if (!$repost_weibos || 0 === $repost_weibos['total_number']) {
    // 我最近转发的微博都不存在了
    echo '<p>我最近转发的微博全都不在了<sub>或者repost_by_me没有获取到</sub></p>';
    $fail_tasks = $task_weibo_mids;
} else {
    $real_weibo_mids = array();
    foreach ($repost_weibos['reposts'] as $weibo) {
        //echo $weibo['retweeted_status']['mid'].'<br />';
        echo $weibo['mid'] . ' -- ' . $weibo['text'] . ' on <sub>' . $weibo['created_at'] . '</sub><br />';
        $real_weibo_mids[] = $weibo['mid'];
    }
    $fail_tasks = array_diff($task_weibo_mids, $real_weibo_mids);
}
echo '<hr />';
echo '<h3>出问题的任务(可能是我删除了这条微博)</h3>';
SaeTClientV2