Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upload_url_text提交总是提示10016,经过调试结果太坑爹了 #17

Open
sbdx opened this issue Sep 12, 2016 · 1 comment
Open

Comments

@sbdx
Copy link

sbdx commented Sep 12, 2016

` ``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却能接收参数。
@xiaosier
Copy link
Owner

感谢反馈,我测试一下。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants