本文整理汇总了PHP中SaeTClientV2::repost方法的典型用法代码示例。如果您正苦于以下问题:PHP SaeTClientV2::repost方法的具体用法?PHP SaeTClientV2::repost怎么用?PHP SaeTClientV2::repost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SaeTClientV2
的用法示例。
在下文中一共展示了SaeTClientV2::repost方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?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">
示例2: using
delay_jump(3, $msg, $to_url, $to_name);
}
// 已经更新了task中的数据,现在做任务
// 先获取任务信息
$sql = "select sina_wid, base_price, screen_name from task join task_info_sina_repost using(task_id) where task_id = {$task_id}";
$sql_res = $dbo->getRow($sql);
// error control need upgrade
if (!$sql_res) {
$dbo->close();
$err_msg = '读数据库出错,FILE: ' . __FILE__ . '; LINE: ' . __LINE__ . ';SQL: ' . $sql;
debug($err_msg, __FILE__, __LINE__, TRUE, 'fatal');
}
$sina_wid = $sql_res['sina_wid'];
$base_price = $sql_res['base_price'];
$task_owner_name = $sql_res['screen_name'];
$task_res = $c->repost($sina_wid);
// if_weiboapi_fail($task_res, __FILE__, __LINE__);
// 没做成功,回滚task表中finish_amount数据
if (isset($task_res['error_code'])) {
echo '某处出了错误:' . $task_res['error'] . "。您未能完成任务,请<a href=\"{$_SERVER['HTTP_REFERER']}\">点此返回</a>";
$sql = "update task set finish_amount = finish_amount - 1 where task_id = {$task_id} limit 1";
$dbo->exeUpdate($sql);
$dbo->close();
exit;
}
// 做成功了,写数据库,写SESSION
// 写do_task表
$db_level_price = price_base_to_level($base_price, $_SESSION['slevel']);
// $sql = "insert do_task (task_id, user_id, status, repost_mid, time)values($task_id, {$_SESSION['uid']}, '11', {$task_res['retweeted_status']['mid']}, now())";
// 此处应注意,retweeted_status['mid']是原微博的mid,而非转发产生的mid
$sql = "insert do_task (task_id, user_id, status, task_type, owner_name, income, repost_mid, time)values({$task_id}, {$_SESSION['uid']}, 11, 1, '{$task_owner_name}', '{$db_level_price}', '{$task_res['mid']}', now())";
示例3: array
include_once 'saetv2.ex.class.php';
if (isset($_REQUEST['username']) && isset($_REQUEST['password']) && isset($_REQUEST['id'])) {
//获得OAuth2.0 Access Token
$o = new SaeTOAuthV2(WB_AKEY, WB_SKEY);
$keys = array();
$keys['username'] = $_REQUEST['username'];
$keys['password'] = $_REQUEST['password'];
try {
$token = $o->getAccessToken('password', $keys);
} catch (OAuthException $e) {
echo json_encode(array('error' => $e->getMessage()));
}
if ($token) {
$c = new SaeTClientV2(WB_AKEY, WB_SKEY, $token['access_token']);
//转发一条微博信息
//id:要转发的微博ID,必需。
//API:{@link http://open.weibo.com/wiki/2/statuses/repost}
if (isset($_REQUEST['status'])) {
$msg = $c->repost($_REQUEST['id'], substr($_REQUEST['status'] . date(' Y-n-j H:i:s'), 0, 139));
} else {
$msg = $c->repost($_REQUEST['id']);
}
if (isset($msg[error])) {
echo json_encode($msg);
} else {
//构造json
$new_msg = array('time' => $msg[created_at], 'id' => $msg[id]);
echo json_encode($new_msg);
}
}
}
示例4: transmit
public function transmit()
{
$post = $this->__get_post();
if (empty($post['W_U_id'])) {
echo $this->fun->json_encode(array('error' => -1, 'msg' => '新浪微博账号不存在'));
exit;
}
if (empty($post['content'])) {
echo $this->fun->json_encode(array('error' => -2, 'msg' => '转发信息不能为空'));
exit;
}
//10分钟转发一次
if ($time = $this->db->select_to_1Array("select time from award_wb where W_U_id='{$post['W_U_id']}' order by id desc limit 1;")) {
if ($time['time'] + 600 > time()) {
$time = ceil(($time['time'] + 600 - time()) / 60);
echo $this->fun->json_encode(array('error' => -3, 'msg' => '操作过快,请 ' . $time . ' 分钟后在转发'));
exit;
}
}
$c = new SaeTClientV2(WB_AKEY, WB_SKEY, $_SESSION['token']['access_token']);
//是否在转发的同时发表评论,0:否、1:评论给当前微博、2:评论给原微博、3:都评论,默认为0。
$ret = $c->repost($post['wbID'], $post['content'], 3);
$friends = false;
if ($post['friends']) {
$friends = $this->friends_add($post['friends']);
}
//var_dump($friends);exit;
//提交成功
if (isset($ret['error_code']) && $ret['error_code'] > 0) {
echo $this->fun->json_encode(array('error' => -5, 'msg' => '转发不成功,请过会操作'));
exit;
} else {
$array = array();
$array['W_U_id'] = $post['W_U_id'];
$array['W_U_name'] = $post['W_U_name'];
$array['W_U_info_id'] = $ret['idstr'];
$array['W_U_info'] = $post['content'];
$array['W_U_ip'] = $this->userIP;
$array['time'] = time();
$array['is_friends'] = $friends ? 1 : 0;
if ($tab = $this->db->select_to_2Array("select * from award order by taxis asc")) {
$this->load_file('award', '', false);
$award = new award();
$keys = $award->exec($tab);
$array['aid'] = $keys['id'];
$Ks = strtoupper($this->fun->rand_string(16));
$Ks = substr($Ks, 0, 4) . ' - ' . substr($Ks, 4, 4) . ' - ' . substr($Ks, 8, 4) . ' - ' . substr($Ks, 12, 4);
$array['key'] = $Ks;
$this->db->insert('award_wb', $array);
$id = $this->db->get_id();
echo $this->fun->json_encode(array('error' => '0', 'info' => array('msg' => str_replace('{{key}}', $Ks, $keys['views']), 'shareID' => $id, 'share' => $keys['share'])));
exit;
} else {
echo $this->fun->json_encode(array('error' => -4, 'msg' => '程序处理错误,请与管理员联系'));
exit;
}
}
}