本文整理汇总了PHP中SaeTClientV2::update方法的典型用法代码示例。如果您正苦于以下问题:PHP SaeTClientV2::update方法的具体用法?PHP SaeTClientV2::update怎么用?PHP SaeTClientV2::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SaeTClientV2
的用法示例。
在下文中一共展示了SaeTClientV2::update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send2wbto
function send2wbto($content)
{
$c = new SaeTClientV2(WB_AKEY, WB_SKEY, file_get_contents("../include/weibo/token.txt"));
$ret = $c->update($content);
//发送微博
if (isset($ret['error_code']) && $ret['error_code'] > 0) {
echo "<p>发送失败,错误:{$ret['error_code']}:{$ret['error']}</p>";
} else {
echo "<p>发送成功</p>";
}
}
示例2: send
/**
* 推送信息
*/
public function send($bind_user, $data)
{
$info = unserialize($bind_user['info']);
$client = new SaeTClientV2($this->setting['app_key'], $this->setting['app_secret'], $info['access_token']);
try {
isset($data['url']) && ($data['content'] = $data['content'] . $data['url']);
if (isset($data['img']) && !empty($data['img'])) {
return $client->upload($data['content'], $data['img']);
} else {
return $client->update($data['content']);
}
} catch (Exception $e) {
}
}
示例3: send
public function send()
{
$post = $this->__get_post();
if (empty($post['id'])) {
echo $this->fun->json_encode(array('error' => -1, 'msg' => '转发的微博信息不不存在'));
exit;
}
$c = new SaeTClientV2(WB_AKEY, WB_SKEY, $_SESSION['token']['access_token']);
$ret = $c->update($post['content']);
if (isset($ret['error_code']) && $ret['error_code'] > 0) {
echo $this->fun->json_encode(array('error' => -5, 'msg' => '转发不成功,请过会操作'));
exit;
//echo "<p>发送失败,错误:{$ret['error_code']}:{$ret['error']}</p>";
} else {
$this->db->update('award_wb', array('share_wb_id' => $ret['idstr']), 'id=' . $post['id']);
echo $this->fun->json_encode(array('error' => '0', 'msg' => '中奖信息分享成功咯'));
exit;
}
}
示例4:
$id = file_get_contents("id.log");
echo $id;
for ($i = 0; $i < count($ms['statuses']); $i++) {
if (!empty($ms['statuses'][$i]['retweeted_status'])) {
if ($ms['statuses'][$i]['retweeted_status']['reposts_count'] > 80 || $ms['statuses'][$i]['retweeted_status']['comments_count'] > 80) {
}
if ($ms['statuses'][$i]['retweeted_status']['id'] > $id) {
if (!empty($ms['statuses'][$i]['retweeted_status']['original_pic'])) {
if (strpos($ms['statuses'][$i]['retweeted_status']['text'], "http") > 0) {
$c->upload(str_replace("http", "(via " . $ms['statuses'][$i]['retweeted_status']['user']['name'] . ") http", $ms['statuses'][$i]['retweeted_status']['text']), $ms['statuses'][$i]['retweeted_status']['original_pic'], null, null);
} else {
$c->upload($ms['statuses'][$i]['retweeted_status']['text'] . "(via " . $ms['statuses'][$i]['retweeted_status']['user']['name'] . ")", $ms['statuses'][$i]['retweeted_status']['original_pic'], null, null);
}
} else {
if (strpos($ms['statuses'][$i]['retweeted_status']['text'], "http") > 0) {
$c->update(str_replace("http", "(via " . $ms['statuses'][$i]['retweeted_status']['user']['name'] . ") http", $ms['statuses'][$i]['retweeted_status']['text']));
} else {
$c->update($ms['statuses'][$i]['retweeted_status']['text'] . "(via " . $ms['statuses'][$i]['retweeted_status']['user']['name'] . ")");
}
}
}
continue;
}
if ($ms['statuses'][$i]['comments_count'] > 80 || $ms['statuses'][$i]['reposts_count'] > 80) {
if ($ms['statuses'][$i]['id'] > $id) {
if (!empty($ms['statuses'][$i]['original_pic'])) {
if (strpos($ms['statuses'][$i]['text'], "http") > 0) {
$c->upload(str_replace("http", "(via " . $ms['statuses'][$i]['user']['name'] . ") http", $ms['statuses'][$i]['text']), $ms['statuses'][$i]['original_pic'], null, null);
} else {
$c->upload($ms['statuses'][$i]['text'] . "(via " . $ms['statuses'][$i]['user']['name'] . ")", $ms['statuses'][$i]['original_pic'], null, null);
}
示例5: addSinaWeiboUpload
/**
* sinaweibo上传图片并发布一条新微博
*/
public function addSinaWeiboUpload($bindinfo, $params)
{
include_once BASE_DATA_PATH . DS . 'api' . DS . 'snsapi' . DS . 'sinaweibo' . DS . 'config.php';
include_once BASE_DATA_PATH . DS . 'api' . DS . 'snsapi' . DS . 'sinaweibo' . DS . 'saetv2.ex.class.php';
$c = new SaeTClientV2(C('share_sinaweibo_appid'), C('share_sinaweibo_appkey'), $bindinfo['snsbind_accesstoken']);
if ($params['images']) {
$c->upload($params['title'] . $params['comment'] . $params['url'], $params['images']);
} else {
$c->update($params['title'] . $params['comment'] . $params['url']);
}
}
示例6: _execute_sinashare
/**
* 新浪微博分享
*
* @param array $data
* @return Bool|String
*/
public function _execute_sinashare($data)
{
$data = dr_string2array($data);
if (!$data) {
return '执行值不存在';
}
$config = (require FCPATH . 'config/oauth.php');
if (!isset($config['sina']) || !isset($config['sina']['key'])) {
return 'Sina配置文件不正确或者Key不存在';
}
// 查询OAuth2授权信息
$auth = $this->db->where('uid', (int) $data['uid'])->where('oauth', 'sina')->limit(1)->get('member_oauth')->row_array();
if (!$auth) {
return '会员uid:' . $data['uid'] . ' 授权信息不存在';
}
require_once FCPATH . 'dayrui/libraries/Share/Sina.php';
$auth = new SaeTClientV2($config['sina']['key'], $config['sina']['secret'], $auth['access_token']);
if ($data['thumb']) {
$call = $auth->upload(dr_strcut($data['title'], 120) . ' ' . $data['url'], $data['thumb']);
} else {
$call = $auth->update(dr_strcut($data['title'], 120) . ' ' . $data['url']);
}
return isset($call['id']) && $call['id'] ? TRUE : (isset($call['error']) && $call['error'] ? $call['error'] : $call);
}
示例7: ajaxsaveweiboreplyAction
function ajaxsaveweiboreplyAction()
{
$this->_helper->layout->disableLayout();
$topicId = urldecode($this->_request->getParam('topicId'));
$annotations = array('wildfire_community', $topicId);
$tokenNamespace = new Zend_Session_Namespace('token');
$token = $tokenNamespace->token;
if ($token) {
include_once 'weiboconfig.php';
$c = new SaeTClientV2(WB_AKEY, WB_SKEY, $token['access_token']);
$content = $this->_request->getParam('content');
$result = $c->update($content, NULL, NULL, $annotations);
if (isset($result['error_code'])) {
print_r($result);
} else {
$mid = $result['idstr'];
$userId = $this->_currentUser->id;
$irrModel = new InboxReplyRecord();
$row = $irrModel->createRow();
$row->topic = $topicId;
$row->consumer = $userId;
$row->platform_type = "weibo";
$row->sns_reply_id = $result['idstr'];
$row->save();
$replyCount = $irrModel->findReplyCount(array('consumer' => $userId, 'platform_type' => 'weibo', 'topic' => $topicId));
if ($replyCount < 2) {
$rewardPointTransactionRecordModel = new RewardPointTransactionRecord();
$rewardPointTransaction = array("consumer_id" => $userId, "date" => date("Y-m-d H:i:s"), "transaction_id" => "11", "point_amount" => "10");
$id = $rewardPointTransactionRecordModel->insert($rewardPointTransaction);
$row->reward_point_transaction_record_id = $id;
$row->save();
$rankModel = new Rank();
$rankModel->changeConsumerRank($userId);
}
echo "ok";
}
}
}
示例8: Sina
function Sina($data)
{
require_once APP_ROOT_PATH . 'system/api_login/sina/saetv2.ex.class.php';
$uid = intval($GLOBALS['user_info']['id']);
$udata = $GLOBALS['db']->getRow("select sina_token from " . DB_PREFIX . "user where id = " . $uid);
$client = new SaeTClientV2($GLOBALS['m_config']['sina_app_key'], $GLOBALS['m_config']['sina_app_secret'], $udata['sina_token']);
if (empty($data['img'])) {
$msg = $client->update($data['content']);
} else {
$msg = $client->upload($data['content'], $data['img']);
}
if ($msg['error']) {
$result['status'] = false;
$result['code'] = $msg['error_code'];
} else {
$result['status'] = true;
$result['code'] = 0;
}
return $result;
}
示例9: yjl_uwb
function yjl_uwb($u, $c, $i, $e = '', $p = '')
{
global $r_main, $yjl_tpath, $dbprefix, $yjl_url, $yjl_isdebug;
if ($yjl_isdebug == 0) {
if (trim($r_main['sina_k']) != '' && trim($r_main['sina_s']) != '') {
$q_rex = sprintf('select profile, access_token from %s where uid=%s and length(access_token)>0 limit 1', $dbprefix . 'xwb_bind_info', $u);
$rex = mysql_query($q_rex) or die(mysql_error());
$r_rex = mysql_fetch_assoc($rex);
if (mysql_num_rows($rex) > 0) {
$a_xwb = json_decode($r_rex['profile'], true);
if (isset($a_xwb['bind_setting']) && $a_xwb['bind_setting'] == 1) {
require_once $e . 'lib/saetv2.ex.class.php';
$so = new SaeTClientV2($r_main['sina_k'], $r_main['sina_s'], $r_rex['access_token']);
if ($p != '') {
$rs = $so->upload($c, $e . $p);
} else {
$rs = $so->update($c);
}
if (isset($rs['mid']) && $rs['mid'] != '') {
$iSQL = sprintf('insert into %s (tid, mid) values (%s, %s)', $dbprefix . 'xwb_bind_topic', $i, $rs['mid']);
$result = mysql_query($iSQL) or die(mysql_error());
}
}
}
mysql_free_result($rex);
}
if (trim($r_main['tqq_k']) != '' && trim($r_main['tqq_s']) != '') {
$q_rex = sprintf('select token, tsecret from %s where uid=%s and length(token)>0 and length(tsecret)>0 and synctoqq>0 limit 1', $dbprefix . 'qqwb_bind_info', $u);
$rex = mysql_query($q_rex) or die(mysql_error());
$r_rex = mysql_fetch_assoc($rex);
if (mysql_num_rows($rex) > 0) {
require_once $e . 'lib/tqq_opent.php';
require_once $e . 'lib/tqq_client.php';
$tqq = new MBApiClient($r_main['tqq_k'], $r_main['tqq_s'], $r_rex['token'], $r_rex['tsecret']);
$tqq_a = array('c' => $c, 'ip' => $_SERVER['REMOTE_ADDR'], 'j' => '', 'w' => '', 'type' => 1);
if ($p != '') {
$ps = getimagesize($p);
$p_data = file_get_contents($p);
$tqq_a['p'] = array($ps['mime'], $p, $p_data);
}
$rq = $tqq->postOne($tqq_a);
if (isset($rq['data']['id']) && $rq['data']['id'] != '') {
$iSQL = sprintf('insert into %s (tid, qqwb_id) values (%s, %s)', $dbprefix . 'qqwb_bind_topic', $i, $rq['data']['id']);
$result = mysql_query($iSQL) or die(mysql_error());
}
}
mysql_free_result($rex);
}
}
}
示例10: sendwb
public function sendwb()
{
// 获取消息正文 发晒单 bask 写心情 mood
/*
* if(isset($this->request->post['bask']) && ($this->request->post['bask'])) { $message_text = $this->request->post['bask']; $message_flag = 1; } else if(isset($this->request->post['mood']) && ($this->request->post['mood'])) { $message_text = $this->request->post['mood']; $message_flag = 2; } else { $message_text = ''; $message_flag = 0; } //获取图片url地址 $this->session->data['token'] if(isset($this->request->post['image']) && ($this->request->post['image'])) { $imgurl = $this->request->post['image']; } else { $imgurl = ''; } //获取视频url地址 if(isset($this->reuqest->post['video']) && ($this->request->post['video'])) { $videourl = $this->request->post['video']; } else { $videourl = ''; } //之前已经登录微博并授权 if (isset($_SESSION['token'])) { } //未登录微博授权 else { include_once(DIR_SYSTEM . 'weibo/config.php'); include_once(DIR_SYSTEM . 'weibo/saetv2.ex.class.php'); if (isset($_GET['code'])) { $keys = array(); $keys['code'] = $_GET['code']; $keys['redirect_uri'] = WBS_CALLBACK_URL; try { $token = $o->getAccessToken('code', $keys); } catch (OAuthException $e) { } } else { echo "<script language=\"javascript\">window.open ('https://api.weibo.com/oauth2/authorize?client_id=".WB_AKEY."&redirect_uri=".WBS_CALLBACK_URL."&response_type=code','newwindow','height=440,width=630,top=150,left=300,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no')</script>"; } }
*/
include_once DIR_SYSTEM . 'weibo/config.php';
include_once DIR_SYSTEM . 'weibo/saetv2.ex.class.php';
$o = new SaeTOAuthV2(WB_AKEY, WB_SKEY);
// 之前未登录微博授权
if (isset($_GET['code'])) {
$keys = array();
$keys['code'] = $_GET['code'];
$keys['redirect_uri'] = WBS_CALLBACK_URL;
try {
$token = $o->getAccessToken('code', $keys);
// $this->session->data['token'] = $token;
} catch (OAuthException $e) {
}
}
if (isset($token) && !empty($token)) {
$this->session->data['token'] = $token;
$c = new SaeTClientV2(WB_AKEY, WB_SKEY, $_SESSION['token']['access_token']);
$ms = $c->home_timeline();
// done
$uid_get = $c->get_uid();
/*
* var_dump($token); var_dump($uid_get);
*/
$uid = $uid_get['uid'];
$user_message = $c->show_user_by_id($uid);
// 根据ID获取用户等基本信息
// 图片微博
if (isset($this->session->data['wb']['imgurl'])) {
$ret = $c->upload($this->session->data['wb']['message_text'] . ' @信恩世通CNstorm', $this->session->data['wb']['imgurl']);
} else {
// 文字微博
$ret = $c->update($this->session->data['wb']['message_text'] . ' @信恩世通CNstorm');
}
// 返回信息
$msg = '';
if (isset($ret['error_code']) && $ret['error_code'] > 0) {
$err = '微博同步失败,';
if ($ret['error_code'] == 20003) {
$msg = $err . "用户不存在";
} elseif ($ret['error_code'] == 20005) {
$msg = $err . "目前仅支持JPG、GIF、PNG的图片";
} elseif ($ret['error_code'] == 20006) {
$msg = $err . "图片太大";
} elseif ($ret['error_code'] == 20012) {
$msg = $err . "输入文字太长,请不要超过140字";
} elseif ($ret['error_code'] == 20015) {
$msg = $err . "账号、IP或应用非法,暂时无法完成此操作";
} elseif ($ret['error_code'] == 20016) {
$msg = $err . "发布内容过于频繁";
} elseif ($ret['error_code'] == 20017) {
$msg = $err . "提交相似的信息";
} elseif ($ret['error_code'] == 20018) {
$msg = $err . "包含非法网址";
} elseif ($ret['error_code'] == 20019) {
$msg = $err . "提交相同的信息";
} elseif ($ret['error_code'] == 20020) {
$msg = $err . "包含广告信息";
} elseif ($ret['error_code'] == 20021) {
$msg = $err . "包含非法内容";
} elseif ($ret['error_code'] == 20022) {
$msg = $err . "此IP地址上的行为异常";
} elseif ($ret['error_code'] == 20032) {
$msg = "发布成功,目前服务器可能会有延迟,请耐心等待1-2分钟";
} else {
$msg = "微博同步失败";
}
} else {
unset($this->session->data['wb']['message_text']);
if (isset($this->session->data['wb']['imgurl'])) {
unset($this->session->data['wb']['imgurl']);
}
$msg = "微博同步成功";
}
echo <<<Eof
<script type="text/javascript">
var i = 3;
function check(){
if(i>0){
i = i - 1;
document.getElementById("time").innerHTML = i;
setTimeout("check()",1000);
}else{
window.opener = null;
window.close();
}
}
setTimeout("check()",1000);
</script>
<body>
<div><p>{$msg}</p></div>
<div>本页面<span id="time">3</span>秒后自动关闭</div>
//.........这里部分代码省略.........
示例11: foreach
<title>新浪微博V2接口演示程序-Powered by Sina App Engine</title>
</head>
<body>
<?php
echo $user_message['screen_name'];
?>
,您好!
<h2 align="left">发送新微博</h2>
<form action="" >
<input type="text" name="text" style="width:300px" />
<input type="submit" />
</form>
<?php
if (isset($_REQUEST['text'])) {
$ret = $c->update($_REQUEST['text']);
//发送微博
if (isset($ret['error_code']) && $ret['error_code'] > 0) {
echo "<p>发送失败,错误:{$ret['error_code']}:{$ret['error']}</p>";
} else {
echo "<p>发送成功</p>";
}
}
?>
<?php
if (is_array($ms['statuses'])) {
foreach ($ms['statuses'] as $item) {
?>
<div style="padding:10px;margin:5px;border:1px solid #ccc">
<?php
示例12: sendweiboAction
public function sendweiboAction()
{
if (!$_POST) {
die;
}
$weiboModel = new WeiboModel();
$token = $weiboModel->token($this->userid);
if (!$token) {
die("notoken");
}
$c = new SaeTClientV2(WB_AKEY, WB_SKEY, $token);
$ret = $c->update($_POST["weibocontent"]);
if ($ret) {
return "ok";
}
}
示例13: weibo_share
public function weibo_share($share_info, $appid = 0)
{
//@todo 91来电秀分离
if ($appid != 29) {
$appid = 0;
}
$token_info = $this->oauth2_check($this->uid, 'weibo', $appid);
if (!$token_info) {
return array('code' => 401);
}
if ($token_info['updated'] + $token_info['expires_in'] < time()) {
return array('code' => 403);
}
require_once Kohana::find_file('vendor', 'weibo/saetv2.ex.class');
$site_setting = $this->weibo_settings($appid);
$c = new SaeTClientV2($site_setting['key'], $site_setting['secret'], $token_info['access_token']);
//$c->set_debug(true);
$status = $share_info['text'];
if ($share_info['video']) {
$r = $c->upload($status, $share_info['video']['url'] . '?filetype=gif');
} elseif ($share_info['images']) {
$r = $c->upload($status, $share_info['images'][0]);
} else {
$r = $c->update($status);
}
if ($r['id']) {
return array('code' => 200);
} elseif (in_array(intval($r['error_code']), array(21315, 21327, 21319))) {
return array('code' => 403);
} else {
return array('code' => 400, 'data' => $r);
}
}
示例14: array
/**
*发微薄函数对图片,视频,文字判断。
*/
function send_weibo()
{
$ret = array();
if (isset($_REQUEST['text'])) {
$str_send = $_REQUEST['text'];
} else {
$str_send = '';
}
$c = new SaeTClientV2(WB_AKEY, WB_SKEY, $_SESSION['weibo_token']['access_token']);
if ($_REQUEST['video']) {
$str_send .= $_REQUEST['video'];
//加入视频
// echo '加入视频 :'.$str_send;
}
if ($_REQUEST['pic']) {
$ret = $c->upload($str_send, $_REQUEST['pic']);
//发送微博,图片
// echo '发送微博,图片 :'.$str_send.$_REQUEST['pic'];
} else {
$ret = $c->update($str_send);
//发送微博
// echo '发送微博 :';
}
if (isset($ret['error_code']) && $ret['error_code'] > 0) {
echo "<p>发送失败,错误:{$ret['error_code']}:{$ret['error']}</p>";
} else {
return $ret;
}
}
示例15: sentShare
public function sentShare($uid, $data)
{
global $_FANWE;
static $client = NULL;
if ($client === NULL) {
$uid = (int) $uid;
$bind = FS("User")->getUserBindByType($uid, 'sina');
$client = new SaeTClientV2($this->config['app_key'], $this->config['app_secret'], $bind['access_token']);
}
try {
$data['content'] .= ' ' . $data['url'];
if (empty($data['img'])) {
$msg = $client->update($data['content']);
} else {
$msg = $client->upload($data['content'], $data['img']);
}
//print_r($msg);
return true;
} catch (Exception $e) {
//print_r($e);
}
return false;
}