Tencent Weibo tips missing parameter ErrorCode 102 error resolution _php tips

Source: Internet
Author: User
Tags error code openid unique id

The example of this article tells the Tencent Weibo hint missing parameter ErrorCode 102 error solution. Share to everyone for your reference. The specific analysis is as follows:

Today in the debugging Tencent Micro-blog interface, there was a mistake, found no relevant information on the Internet, and finally made their own, so the release of this article, to avoid you phper repeat the wheel.

Error message, the code is as follows:

Copy Code code as follows:
StdClass Object
(
[Data] =>
[Detailerrinfo] => stdClass Object
(
[Accesstoken] =>
[Apiname] => www.jb51.net
[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
)

In the official information of Tencent Weibo's open platform, no development document explaining this error code 102 was found, and after comparing with Tencent's microblog PHP SDK, a parameter was found missing.

Workaround for error code 102:

Oauth_version is required in the parameter that requests the user data, and in OAuth2, its value must be 2.a.

In the requested parameter, the OAuth2 part should contain:

Field Description
Oauth_consumer_key Appkey
Access_token Authorization to obtain the Accesstoken
Openid Authorized access to OpenID
ClientIP IP for Client
Oauth_version Version number, must be 2.a
Scope Request permission Range (default "all")

Drupal Tencent Micro Blog Login Instance code:

Copy Code code 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: If you add a field, you will need to re authorize it again from the login page, or you may receive the error "Check sign error" error code 36.

The following duplicate flush interface results in a signature error return value, as follows:

Copy Code code as follows:
StdClass Object
(
[Data] =>
[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
)

Get Tencent Weibo user data, get the current logged-in user's profile User/info interface return value of the field description, the code is as follows:
Copy Code code as follows:
{
Errcode: Return error code,
Msg: Error message,
RET: Return value, 0-success, non 0-failed,
Data:
{
Birth_day: The day of birth,
Birth_month: Birth month,
Birth_year: Year of birth,
City_code: City ID,
Comp:
{
Begin_year: The beginning of the year,
Company_Name: Company Name,
Department_name: Department Name,
End_year: End year,
ID: Company ID
},
Country_code: Country ID,
EDU: Educational Information
{
DepartmentID: Faculty ID,
ID: Education Information Record ID,
Level: Degree,
SchoolID: School ID,
Year: Into the academic years
},
Fansnum: Number of listeners,
Favnum: Collection number,
Head: Avatar URL,
Homecity_code: Home city ID,
Homecountry_code: Home country ID,
Homepage: Personal homepage,
Homeprovince_code: Home province ID,
Hometown_code: Home town ID,
Idolnum: The number of listeners,
Industry_code: Industry ID,
Introduction: Personal Introduction,
Isent: Is it an enterprise organization,
Ismyblack: Whether in the current user's blacklist, 0-not, 1-is,
Ismyfans: Is the listener of the current user, 0-not, 1-yes,
Ismyidol: Is the idol of the current user, 0-not, 1-yes,
Isrealname: Whether real name certification, 1-has real-name certification, 2-real name certification,
ISVIP: Authenticated user, 0-not, 1-yes,
Location: Location,
Mutual_fans_num: Listen to the number of friends,
Name: User account name,
Nick: User nickname,
OpenID: User unique ID, corresponding to name,
Province_code: Region ID,
Regtime: Registration Time,
Send_private_flag: Allow all people to send DMS to current users, 0-only idols, 1-celebrities + listeners, 2-all,
Sex: User sex, 1-male, 2-female, 0-not filled,
Tag: Tags
{
ID: Personal Label ID,
Name: Label name
},
Tweetinfo: A recent piece of original microblogging information
{
City_code: City Code,
Country_code: Country Code,
Emotiontype: Mood Type,
Emotionurl: Mood picture URL,
From: Source,
Fromurl: Source URL,
Geo: Location information,
ID: Weibo unique ID,
Image: List of picture URLs,
Latitude: Latitude,
Location: Location of the publisher,
Longitude: Longitude,
Music: Audio Information
{
Author: singer,
URL: Audio address,
Title: Audio name, song name
},
Origtext: Original content,
Province_code: Province Code,
Self: Is it a self issued microblog, 0-not, 1-yes,
Status: Microblogging status, 0-Normal, 1-system Delete, 2-Audit, 3-User Delete, 4-root Delete,
Text: Micro Blog content,
Timestamp: Server timestamp, cannot be used for paging,
Type: Microblogging types, 1-Original publication, 2-Reprint, 3-DMS, 4-reply, 5-empty back, 6-mentioned, 7-commented,
Videos: Video Information
{
Picurl: Thumbnails,
Player: Player Address,
Realurl: Video Original address,
Shorturl: Short URL for the video,
Title: Video Titles
}
},
Tweetnum: The number of tweets published,
Verifyinfo: Authentication information,
Exp: Experience Value,
Level: Micro Bo Grade
},
SEQID: Serial Number
}

The rest is very easy, dealing with the logical business of your own program part.

I hope this article will help you with your PHP program design.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.