Method 1 to obtain Access Token:
You can modify it manually here:
https://api.weixin .qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET
The appid and secret we want to use here can be obtained in the test, as shown in the figure below :
Then modify it manually:
Then ask the question, you can see that he returns a json format data
{"access_token":"fNNeJ5DpjmpE8SkZnyeByVP4x pqnZRMRkwlhZ7HZemT_WiULJ2YnpsNr4UgTG4zoJo5uMeOA2hFy2rlzOg-U9hnSpHuUuZMZRgI4ZhDK6KN_OIbNxHvfvdl4_wbW775oWKIdAAAIWU","expires_in": 7200}
Method 2 to obtain Access Token:
Call the program get_token.php, and then upload the file to your own WeChat server and browse By calling get_token.php in the server, you can also get the value of the access token.
get_token.php The code is as follows:
<?php //原理,就是使用curl函数,发出http请求,获取access_token $appid = 'wxed89d8f74fa6fc51'; $appsecret = 'd4624c36b6795d1d99dcf0547af5443d'; $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appid}&secret={$appsecret}"; //我们使用curl函数 //初始化 $ch = curl_init(); //设置变量 curl_setopt($ch, CURLOPT_URL,$url); //这意思是,设置好发送的url地址发送到那 //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,$url); 这样的意思是对方要不要验证,如果不用则按照下面的即可 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,FALSE); //如果不用验证,这样即可 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,FALSE); //如果不用验证HOST主机这样即可 curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); //将curl_exec()获取的信息以文件流的形式返回,而不是直接输出 //执行 $output = curl_exec($ch); //返回来的值是一个json格式的值 //对返回的json结果要将他转为一个数组 $jsoninfo = json_decode($output,true); //测试以下,看下是否拿到返的回数组 //var_dump($jsoninfo); $access_token = $jsoninfo['access_token'];
For more articles related to WeChat development and obtaining access_token, please pay attention to the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

Dreamweaver CS6
Visual web development tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Dreamweaver Mac version
Visual web development tools

SublimeText3 English version
Recommended: Win version, supports code prompts!
