Home > Backend Development > PHP Tutorial > WeChat General Interface Document_PHP Tutorial

WeChat General Interface Document_PHP Tutorial

WBOY
Release: 2016-07-20 10:59:07
Original
1354 people have browsed it

Introduction

The general interface uses HTTP requests to allow developers to directly interact with the WeChat server to implement functions such as media file upload and media file acquisition, and achieve the purpose of obtaining media files such as pictures, voices, and videos.

The access_token required to call the interface must be obtained through the credential acquisition interface.

Get Voucher

Interface Description

Before using the common interface, you need to do the following two steps:

1. Have a WeChat public account and obtain the appid and appsecret (obtain it after applying for the custom menu function on the public platform, turning on the developer mode, and filling in the URL and Token)

2. Obtain access_token through the credential acquisition interface

Note:

access_token是第三方访问api资源的票据;
access_token对应于公众号是全局唯一的票据,重复获取将导致上次获取的access_token失效。
Copy after login

Request instructions

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

Parameter description

参数 是否必须 说明
grant_type 获取access_token填写client_credential
appid 第三方用户唯一凭证
secret 第三方用户唯一凭证密钥,既appsecret

Return instructions

Correct Json return result:

{"access_token":"ACCESS_TOKEN","expires_in":7200}
Copy after login
参数 说明
access_token 获取到的凭证
expires_in 凭证有效时间,单位:秒

Incorrect Json return example:

{"errcode":40013,"errmsg":"invalid appid"}
Copy after login

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445641.htmlTechArticleIntroduction The common interface uses HTTP requests to allow developers to interact directly with the WeChat server to implement media file uploads and media files Get other functions to get pictures, voices, videos, etc...
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