亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Table of Contents
Attachment: Global return code description
附:接口頻率限制說明
Home WeChat Applet WeChat Development WeChat public platform development-ACCESS TOKEN

WeChat public platform development-ACCESS TOKEN

Feb 28, 2017 am 10:14 AM

This article introduces the concept and method of obtaining Access Token under the WeChat public platform.

1. Access Token

access_token is the globally unique ticket of the public account. The public account needs to use access_token when calling each interface. Under normal circumstances, access_token is valid for 7200 seconds. Repeated acquisition will cause the last access_token to become invalid.

The public account can use AppID and AppSecret to call this interface to obtain access_token. AppID and AppSecret can be obtained in development mode (you need to be a developer and your account has no abnormal status). Note that the https protocol must be used when calling all WeChat interfaces.

Interface call request description

http請求方式:?GET
https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET

Parameter description

Parameter Is it necessary Explanation
grant_type Yes Get access_token and fill in client_credential
appid is The only credential for third-party users
secret is The unique credential key for third-party users, both appsecret

Return instructions

Under normal circumstances, WeChat will return the following JSON data packet to the public account:

{"access_token":"ACCESS_TOKEN","expires_in":7200}
##access_token Obtained voucherexpires_inVoucher validity time, unit: seconds
ParametersDescription
WeChat will return in case of error Error code and other information, the JSON data packet example is as follows (this example is an invalid AppID error):

{"errcode":40013,"errmsg":"invalid appid"}

2. AppId and AppSecret

Use the WeChat background to find advanced functions - Development mode

微信公眾平臺開發(fā)-ACCESS TOKEN

After becoming a developer, you can see the appid and appsecert

微信公眾平臺開發(fā)-ACCESS TOKEN

If there is no url and Token, you can first use the following test from Fangbei Studio to pass

URL: http://discuz.comli.com/test.php

Token: weixin

3. Obtain Access Token

The program is implemented as follows

$appid = "";
$appsecret = "";
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=$appid&secret=$appsecret";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
$jsoninfo = json_decode($output, true);
$access_token = $jsoninfo["access_token"];

You can also splice the address directly in the browser address bar, and after execution, obtain The following data


{"access_token":"N2L7KXa084WvelONYjkJ_traBMCCvy_UKmpUUzlrQ0EA2yNp3Iz6eSUrRG0bhaR_viswd50vDuPkY5nG43d1gbm-olT2KRMxOsVE08RfeD9lvK9lMguNG9kpIkKGZEjIf8Jv2m9fFhf8bnNa-yQH3g","expires_in":7200}

The parameter description is as follows



##access_token##expires_in
##Parameter

Description

Obtained voucher

The validity time of the voucher, unit: seconds


Or use the official interface debugging tool, the address is:

Use the web debugging tool to debug the custom menu interface

微信公眾平臺開發(fā)-ACCESS TOKEN

Click to check the problem and get

微信公眾平臺開發(fā)-ACCESS TOKEN

In this way, you also get the access token


Attachment: Global return code description

Every time a public account calls an interface, it may get a correct or incorrect return code. Developers can debug the interface based on the return code information and troubleshoot errors.

The global return code description is as follows:

##40008 Illegal message type40009Illegal image file size##4001040011##40012Illegal thumbnail file size40013Illegal APPID40014Illegal access_tokenIllegal menu typeNumber of illegal buttonsNumber of illegal buttonsIllegal button name lengthIllegal button KEY lengthIllegal button URL lengthIllegal menu version numberNumber of illegal submenu levelsNumber of illegal submenu buttons##40024Illegal submenu button type40025Illegal submenu button name length 40026Illegal submenu button KEY length40027Illegal submenu button URL length40028Illegal custom menu user40029Illegal oauth_code40030Illegal refresh_token40031Illegal openid list40032Illegal openid list length40033Illegal request characters, cannot contain \uxxxx format characters40035Illegal parameters40038Illegal request format40039Illegal URL length40050Illegal group id40051The group name is illegal41001The access_token parameter is missing##42002refresh_token timeout##42003430014300243003430044300544001 ##44002The POST packet is empty44003The graphic message content is empty44004The text message content is empty45001Multimedia file size exceeds limit45002Message content exceeds limit45003 Title field exceeds limit45004Description field exceeds limit45005Link field exceeds limit 45006The picture link field exceeds the limit45007The voice playback time exceeds the limit45008The graphic message exceeds the limit45009The interface call exceeds the limit45010The number of created menus exceeds the limit45015The reply time exceeds the limit45016System grouping, modification is not allowed45017The group name is too long45018The number of groups exceeds the upper limit46001No media data exists46002 Menu version that does not exist46003Menu data that does not existNon-existent userParsing JSON/XML content errorapi function not authorizedThe user has not authorized the api<fieldset id="cmiw8"><xmp id="cmiw8"></xmp></fieldset><noframes id="cmiw8"><fieldset id="cmiw8"></fieldset></noframes>
    • Return codeDescription
      -1System busy
      0Request successful
      40001AppSecret error when obtaining access_token, or access_token is invalid
      40002Illegal credential type
      40003Illegal OpenID
      40004Illegal media file type
      40005Illegal file type
      40006Illegal file size
      40007Illegal media file id
      Illegal voice file size
      Illegal video file size
      ##40015
      40016
      40017
      40018
      40019
      40020
      40021
      40022
      40023
      ##41002Missing appid parameter
      41003Missing refresh_token parameter
      41004Missing secret parameter
      41005Missing multimedia file data
      41006Missing media_id parameter
      41007Missing submenu data
      41008Missing oauth code
      41009Missing openid
      42001access_token timeout
      oauth_code timeout
      Requires GET request
      Requires POST request
      Requires HTTPS request
      Requires receiver attention
      Requires friend relationship
      The multimedia file is empty
      ##46004
      47001
      48001
      50001


      附:接口頻率限制說明

      公眾號調(diào)用接口并不是無限制的。為了防止公眾號的程序錯誤而引發(fā)微信服務器負載異常,默認情況下,每個公眾號調(diào)用接口都不能超過一定限制,當超過一定限制時,調(diào)用對應接口會收到如下錯誤返回碼:

      {"errcode":45009,"errmsg":"api freq out of limit"}

      各接口調(diào)用頻率限制如下:

      接口 每日限額
      獲取access_token 2000
      自定義菜單創(chuàng)建 1000
      自定義菜單查詢 10000
      自定義菜單刪除 1000
      創(chuàng)建分組 1000
      獲取分組 1000
      修改分組名 1000
      移動用戶分組 100000
      上傳多媒體文件 5000
      下載多媒體文件 10000
      發(fā)送客服消息 500000
      獲取帶參數(shù)的二維碼 10000
      獲取關注者列表 500
      獲取用戶基本信息 5000000
      獲取網(wǎng)頁授權access_token 2000000
      刷新網(wǎng)頁授權access_token 2000000
      網(wǎng)頁授權獲取用戶信息 2000000


      更多微信公眾平臺開發(fā)-ACCESS TOKEN?相關文章請關注PHP中文網(wǎng)!


      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

      Hot AI Tools

      Undress AI Tool

      Undress AI Tool

      Undress images for free

      Undresser.AI Undress

      Undresser.AI Undress

      AI-powered app for creating realistic nude photos

      AI Clothes Remover

      AI Clothes Remover

      Online AI tool for removing clothes from photos.

      Clothoff.io

      Clothoff.io

      AI clothes remover

      Video Face Swap

      Video Face Swap

      Swap faces in any video effortlessly with our completely free AI face swap tool!

      Hot Tools

      Notepad++7.3.1

      Notepad++7.3.1

      Easy-to-use and free code editor

      SublimeText3 Chinese version

      SublimeText3 Chinese version

      Chinese version, very easy to use

      Zend Studio 13.0.1

      Zend Studio 13.0.1

      Powerful PHP integrated development environment

      Dreamweaver CS6

      Dreamweaver CS6

      Visual web development tools

      SublimeText3 Mac version

      SublimeText3 Mac version

      God-level code editing software (SublimeText3)

      Hot Topics

      PHP Tutorial
      1488
      72
      • <fieldset id="cmiw8"><xmp id="cmiw8"></xmp></fieldset>
          <dfn id="cmiw8"></dfn>