Home > Backend Development > PHP Tutorial > Tencent Weibo prompts missing parameter errorcode 102 error solution, parametererrorcode_PHP tutorial

Tencent Weibo prompts missing parameter errorcode 102 error solution, parametererrorcode_PHP tutorial

WBOY
Release: 2016-07-13 10:11:08
Original
1425 people have browsed it

Tencent Weibo prompts missing parameter errorcode 102 error solution, parametererrorcode

The example in this article describes the solution to the missing parameter errorcode 102 error prompted by Tencent Weibo. Share it with everyone for your reference. The specific analysis is as follows:

When debugging the Tencent Weibo interface today, an error occurred. There was no relevant information on the Internet. I finally adjusted it myself, so I published this article to avoid phpers from reinventing the wheel.

Error message, the code is as follows:

Copy code The code is as follows:
stdClass Object
(
[data] =>
[detailerrinfo] => stdClass Object
(
                                                                                                                                                                                            [accesstoken] => [Apiname] = & GT; www.jb51.net
​​​​​​[appkey] => [clientip] => 112.193.138.133
                                                                                                                                                                                      [cmd] => [proctime] => 0
[ret1] => 3
[ret2] => 3
[ret3] => 102
                                         [ret4] => [Timestamp] = & GT; 1394436892
)

[errcode] => 102
[msg] => missing parameter
[ret] => 3
[seqid] => 1394436894
)

In the official information of Tencent Weibo Open Platform, no development document explaining this error code 102 was found. After comparing with Tencent Weibo PHP SDK, it was found that one parameter was missing.

How to solve error code 102:

oauth_version is required in the parameter requesting user information, and in OAuth2, its value must be 2.a.

In the request parameters, the OAuth2 part must include:

Drupal Tencent Weibo login example code:

Copy code The code is as follows:
$http = drupal_http_request(url('https://open.t.qq.com/api/user/ info', array(
'query' => 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',
),
)));

Note: After adding the fields, you need to re-authorize from the login page, otherwise the error "check sign error" will appear. Error code 36.

The following signature error return value caused by repeated refresh of the interface, the code is as follows:

Copy code The code is as follows:
stdClass Object
(
[data] =>
[detailerrinfo] => stdClass Object
(
                                                                                                                                                                                            [accesstoken] =>                                                                                                                                                                                                  [apiname] => weibo.user.info
                                                                                                                [appkey] =>                                              [clientip] => [cmd] => 0
[proctime] => 0
[ret1] => 3
[ret2] => 3
[ret3] => 36
[ret4] => 2636350730
                                                                                                                                                                      [timestamp] => )

[errcode] => 36
[msg] => check sign error
[ret] => 3
[seqid] => 1394437227
)

Obtain Tencent Weibo user information and obtain the personal information of the currently logged in user. Field description of the return value of the user/info interface, the code is as follows:


Copy code
The code is as follows:
{
errcode: return error code,
msg: error message,
ret: return value, 0-success, non-0-failure,
data:
{
birth_day: day of birth,
birth_month: birth month,
birth_year : year of birth,
city_code: city id,
comp :
{
begin_year : starting year,
company_name: company name,
department_name: department name,
end_year: end year,
id: company id
},
country_code: country id,
edu : Educational information
{
departmentid: department id,
id: education information record id,
level: academic level,
schoolid: school id,
year : year of admission
},
fansnum: Number of listeners,
favnum: number of collections,
head: avatar url,
homecity_code: hometown city id,
homecountry_code: home country id,
homepage: personal homepage,
homeprovince_code: home province id,
hometown_code: hometown town id,
idolnum: Number of people listening,
industry_code: industry id,
introduction: personal introduction,
isent: whether it is a corporate organization,
ismyblack: Whether it is in the current user’s blacklist, 0-no, 1-yes,
ismyfans: Whether it is the current user’s audience, 0-no, 1-yes,
ismyidol: whether it is the idol of the current user, 0-no, 1-yes,
isrealname: Whether to use real-name authentication, 1-real-name authentication, 2-not real-name authentication,
isvip: whether to authenticate the user, 0-no, 1-yes,
location : location,
mutual_fans_num: Number of mutual listening friends,
name : user account name,
nick: User nickname,
openid: user’s unique id, corresponding to name,
province_code: region id,
regtime: registration time,
send_private_flag: Whether to allow everyone to send private messages to the current user, 0-only idols, 1-celebrities + listeners, 2-everyone,
sex: User gender, 1-male, 2-female, 0-not filled in,
tag : tag
{
id: personal tag id,
name: tag name
},
tweetinfo : The most recent original Weibo message
{
city_code: city code,
Country_code: country code,
emotiontype : emotion type,
emotionurl: mood picture url,
From : source,
fromurl: source url,
geo : geographical location information,
id: Weibo’s unique id,
Image: Image URL list,
latitude : latitude,
Location: The location of the publisher,
longitude : longitude,
music : audio information
{
Author : singer,
url: audio address,
Title: Audio name, song title
},
origtext : original content,
province_code: province code,
Self: Whether the Weibo is posted by oneself, 0-no, 1-yes,
Status: Weibo status, 0-normal, 1-system deleted, 2-under review, 3-user deleted, 4-root deleted,
text: Weibo content,
timestamp: server timestamp, cannot be used for page turning,
Type: Weibo type, 1-original post, 2-reprint, 3-private message, 4-reply, 5-blank reply, 6-mention, 7-comment,
video : video information
{
Picurl: thumbnail,
Player: player address,
realurl: video original address,
Shorturl: the short url of the video,
Title: video title
}
},
tweetnum: Number of Weibo posts published,
verifyinfo: certification information,
exp: experience value,
level: Weibo level
},
seqid: serial number
}

The rest is very easy, handle the logic business of your own program part.

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/931546.htmlTechArticleTencent Weibo prompts missing parameter errorcode 102 error solution, parametererrorcode This article describes an example of Tencent Weibo prompting missing parameter errorcode 102 error solution...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template