本文实例讲述了腾讯微博提示missing parameter errorcode 102 错误的解决方法。分享给大家供大家参考。具体分析如下:
今天在调试腾讯微博接口时,出现一个错误,找了网上都没有相关资料,最后自己调通了,故发布此文,避免各位PHPer重复造轮子.
代码如下:
[detailerrinfo] => stdClass Object
(
[accesstoken] =>
[apiname] => www.jb51.cc
[appkey] => 801485800
[clientip] => 112.193.138.133
[cmd] => 0
[proctime] => 0
[ret1] => 3
[ret2] => 3
[ret3] => 102
[ret4] => 3659629834
[timestamp] => 1394436892
)
[errcode] => 102
[msg] => missing parameter
[ret] => 3
[seqid] => 1394436894
)
在腾讯微博开放平台的官方资料中,未发现解释此错误代码102的开发文档,经过与腾讯微博PHP SDK对比后发现少了一个参数.
在请求用户资料的参数中oauth_version是必填的,而且在OAuth2中,它的值必须为2.a.
请求的参数中,OAuth2部分需包含:
代码如下:
array(
'access_token' => $access_token,
'oauth_consumer_key' => $provider['key'],
'openid' => $_GET['openid'],
'clientip' => ip_address(),
'scope' => 'all',
'seqid' => REQUEST_TIME,
'serverip' => $_SERVER['SERVER_ADDR'],
'oauth_version' => '2.a',
//'appfrom' => 'PHP-sdk2.0beta',
),
)));
注意:加上字段后需要重新从登录页面重新授权一次,不然会出现错误“check sign error” 错误代码36.
代码如下:
[detailerrinfo] => stdClass Object
(
[accesstoken] =>
[apiname] => weibo.user.info
[appkey] => 801485800
[clientip] => 112.193.138.133
[cmd] => 0
[proctime] => 0
[ret1] => 3
[ret2] => 3
[ret3] => 36
[ret4] => 2636350730
[timestamp] => 1394437225
)
[errcode] => 36
[msg] => check sign error
[ret] => 3
[seqid] => 1394437227
)
获取腾讯微博用户资料,获取当前登录用户的个人资料 user/info 接口返回值的字段说明,代码如下:
<div class="codetitle"><a style="CURSOR: pointer" data="10764" class="copybut" id="copybut10764" onclick="doCopy('code10764')"> 代码如下: