xiaosier / libweibo Goto Github PK
View Code? Open in Web Editor NEW新浪微博开放平台php sdk(Sina Weibo open platform php sdk)
Home Page: http://open.weibo.com
新浪微博开放平台php sdk(Sina Weibo open platform php sdk)
Home Page: http://open.weibo.com
单图不管是本地还是在线都能发布成功通过 share($status, $pic = false, $rip = false) 想问一下 多图这个$pic需要怎么样的格式 ?
能把地点写入接口也加上吗
谢谢- -
你好,我用你的代码授权成功了,我不知道怎么获取用户信息,我现在想要接入微博直播的接口,请问up主可以指点一下吗
替换saetv2.ex.class.php文件?
强烈建议添加composer!!!!!!!!!!!!!!!!!
` ``php
/**
* 指定一个图片URL地址抓取后上传并同时发布一条新微博
*
* 对应API:{@link http://open.weibo.com/wiki/2/statuses/upload_url_text statuses/upload_url_text}
*
* @param string $status 要发布的微博文本内容,内容不超过140个汉字。
* @param int $visible 微博的可见性,0:所有人能看,1:仅自己可见,2:密友可见,3:指定分组可见,默认为0
* @param string $list_id 微博的保护投递指定分组ID,只有当visible参数为3时生效且必选。
* @param string $pic_id 已经上传的图片pid,多个时使用英文半角逗号符分隔,最多不超过9个。
* @param float $lat 纬度,有效范围:-90.0到+90.0,+表示北纬,默认为0.0。
* @param float $long 经度,有效范围:-180.0到+180.0,+表示东经,默认为0.0。
* @param string $annotations 元数据,主要是为了方便第三方应用记录一些适合于自己使用的信息,每条微博可以包含一个或者多个元数据,
* 必须以json字串的形式提交,字串长度不超过512个字符,具体内容可以自定。
* @param string $url 图片的URL地址,必须以http开头。
* @return array
*/
function upload_url_text( $status, $url , $visible=0, $list_id=NULL, $pic_id=NULL, $lat = NULL, $long=NULL, $annotations=NULL)
{
$params = array();
$params['status'] = $status;
$params['url'] = $url;
$params['visible'] = $visible;
if (!is_null($list_id)) {
$params['list_id'] = $list_id;
}
if (!is_null($pic_id)) {
$params['pic_id'] = $pic_id;
}
if (!is_null($lat)) {
$params['lat'] = $lat;
}
if (!is_null($long)) {
$params['long'] = $long;
}
if (!is_null($annotations)) {
$params['annotations'] = $annotations;
}
return $this->oauth->post( 'statuses/upload_url_text', $params, true);
}
无论怎么改,怎么抓包,怎么调试信息,都提示没有提交status
返回结果
{"error":"miss required parameter (status), see doc for more info.","error_code":10016,"request":"/2/statuses/upload_url_text.json"}
最后发现需要修改SDK,post最后一个参数应该改为false。
默认使用
Content-Type: multipart/form-data
但是这里应该改用
Content-Type:application/x-www-form-urlencoded
奇怪的问题,同样的代码,upload却能接收参数。
授权之后使用长微博接口提示error":"auth by Null spi!","error_code":21301
发部 --> 发布
SDK中的demo也是一样。
CODE: 10014
例如 get_token_info 接口,sdk 貌似没加上,得自己扩展。不知道官方啥时候更新sdk呢?
第三方分享微博内容,分享成功之后API返回NULL
微博已经发送成功,
但是接口API却返回NULL
apache 2.4.39
php 5.6.40
Notice: curl_setopt(): CURLOPT_SSL_VERIFYHOST with value 1 is deprecated and will be removed as of libcurl 7.28.1. It is recommended to use value 2 instead in xxxxxx/saetv2.ex.class.php on line 357
code可以拿到,但是callback.php报错:
SaeTOAuthV2->getAccessToken('code', Array) 授权失败
网站应用里,授权回调和安全域名设置都是对的。
代码是把gihub上的源码config参数修改了,其他没动过
请问有人知道原因吗?
=====post data======
string(192) "client_id=1688866701&client_secret=******&grant_type=authorization_code&code=5209649ceb42048370eac2e6c4146f2c&redirect_uri=http%3A%2F%2Fzhubo.baidu.com%2Fadmin%2Finfo"
=====headers======
Array
(
[0] => API-RemoteIP: 10.92.71.24
)
=====request info=====
Array
(
[url] => https://api.weibo.com/oauth2/access_token
[content_type] =>
[http_code] => 0
[header_size] => 0
[request_size] => 0
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0.000189
[namelookup_time] => 0.004267
[connect_time] => 0
[pretransfer_time] => 0
[size_upload] => 0
[size_download] => 0
[speed_download] => 0
[speed_upload] => 0
[download_content_length] => -1
[upload_content_length] => -1
[starttransfer_time] => 0
[redirect_time] => 0
[certinfo] => Array
(
)
[primary_ip] => 180.149.135.176
[redirect_url] =>
)
一直报错
demo
$c = new SaeTClientV2( WB_AKEY , WB_SKEY , WB_ACCESSTOKEN );
// 待发送的文字内容
$status = '发送的文字内容';
// 本地一张图片,也可以不带图片
$file_local = '5486087cly1fhh2yaksr1j20j60srtd0.jpg';
// 拼接'http://weibosdk.sinaapp.com/'是因为这个share接口至少要带上一个【安全域名】下的链接。
$ret = $c->share($status.'http://weibosdk.sinaapp.com/', $file_local);
var_dump($ret);
也是报错,安全域名已经添加了,urlencode也试过了
调用search_statuses_high函数的时候返回
array(2) {
'error_code' =>
int(21409)
'error' =>
string(21) "illegal sid or no sid"
}
这个错误,查了文档,并没有收入这个错误,不知该如何解决?
这个sdk还会继续更新吗(⊙_⊙)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.