WeChat public platform OAuth2.0 web page authorization php example
巴扎黑
Release: 2016-11-11 17:40:28
Original
1919 people have browsed it
Users can obtain login information by scanning the QR code provided on the web page. Please use it for reference Please download the snoopy class first
The code is as follows: /** * WeChat Public Platform PHP-SDK * Wechatauth is an unofficial WeChat login API * Users can obtain login information by scanning the QR code provided on the web page * Mainly implements the following functions: * get_login_code() Obtains the login authorization code, through Only the authorization code can be obtained to obtain the QR code * get_code_image($code='') Convert the authorization code obtained above into the image QR code * verify_code() Verify whether the login is successful, and return 200 for the final authorization success. * get_login_cookie( ) After successful authentication, call this method to obtain the user's basic information * sendNews($account,$title,$summary,$content,$pic,$srcurl='') Send graphic and text information to a WeChat account * get_avatar( $url) Get user avatar image data * @author dodge * @link https://github.com/dodgepudding/wechat-php-sdk * @version 1.1 * */ include "snoopy.class .php"; class Wechatauth { /data/cookie_'; private $debug; use using use using using using using out out out through ’’s ’ through ’’ ‐ ‐‐‐‐‐‐‐ public $debug; _account = isset($options['account' ])?$options['account']:''; this->debug = isset($options['debug'])?$options['debug']:false; logcallback']:false; $this->_cookiename = $this->_datapath.$this->_account; /** */Public Function SaveCookie ($ FILENAME, $ Content) { Return File_Put_Contents ($ FILENAME, $ Content); /** */ C Function GetCookie ($ FILENAME) { if (file_exists($filename)) { if ($mtime
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