对应API:{@link http://open.weibo.com/wiki/2/comments/show comments/show}
public get_comments_by_sid ( integer $sid, integer $page = 1, integer $count = 50, integer $since_id, integer $max_id, integer $filter_by_author ) : array | ||
$sid | integer | 需要查询的微博ID。 |
$page | integer | 返回结果的页码,默认为1。 |
$count | integer | 单页返回的记录条数,默认为50。 |
$since_id | integer | 若指定此参数,则返回ID比since_id大的评论(即比since_id时间晚的评论),默认为0。 |
$max_id | integer | 若指定此参数,则返回ID小于或等于max_id的评论,默认为0。 |
$filter_by_author | integer | 作者筛选类型,0:全部、1:我关注的人、2:陌生人,默认为0。 |
return | array |
<?php session_start(); include_once '../class/config.php'; include_once '../class/saetv2.ex.class.php'; header("Content-type: text/html; charset=utf-8"); $c = new SaeTClientV2(WB_AKEY, WB_SKEY, $_SESSION['weibo_token']['access_token']); //评论功能 if (isset($_POST['pinglunid']) && isset($_POST['neirong'])) { $c->send_comment($_POST['pinglunid'], $_POST['neirong']); } //转发功能 if (isset($_POST['zhuanfaid']) && isset($_POST['zhuanfa'])) { $c->repost($_POST['zhuanfaid'], $_POST['zhuanfa']); } $pl = $c->get_comments_by_sid($_POST['weibomid']); //获取评论列表 $bq = $c->emotions(); //读取表情 ?> <div class="submit_comment"> <form action=""> <textarea name="" class="comment_text" cols="30" rows="10"></textarea> <div class="comment_button" alt="">评论</div> </form> <div class="comment_biaoqing"> <span class="comment_biaoqing_trigger"></span> </div> <div class="comment_biaoqing_floatbox hide">
echo $item_a['user']['screen_name'].':'; echo $item_a['text']; echo '<br>'; } } */ } } //echo 'sizeof:'.sizeof($sortsid).'<br>'; echo '</div>'; } } rsort($sortsid); print_r($sortsid); $gc_bysid = $c->get_comments_by_sid($sortsid[0]); if (is_array($gc_bysid['comments'])) { foreach ($gc_bysid['comments'] as $item_a) { echo $item_a['user']['screen_name'] . ':'; echo $item_a['text']; echo '<br>'; } } /* 获取用户的所有微博和评论 $ut_byid = $c->user_timeline_by_id($targetid,1,10); //返回用户发布的最近n条信息,读评论时发现只能取50条,时间间隔有限制应该 if( is_array( $ut_byid['statuses'] ) ) { foreach( $ut_byid['statuses'] as $item_u ) { echo '<div style="padding:10px;margin:5px;border:1px solid #ccc">'; echo '############<br>';