Home PHP Libraries Other libraries php qq login class
php qq login class
<?php
class qqlogin{
  public $app_id;
  public $app_key;
  public $callback;
  public $code;
  public $state;
  public function __construct($app_id,$app_key,$callback){
    $this->code = isset($_REQUEST['code'])? $_REQUEST['code'] : '';
    $this->state = isset($_REQUEST['state'])? $_REQUEST['state'] : '';
    $this->app_id = $app_id;
    $this->app_key = $app_key;
    $this->callback = $callback;
  }
  public function get_token(){
    $url = "https://graph.qq.com/oauth2.0/token?grant_type=authorization_code&client_id=".$this->app_id."&client_secret=".$this->app_key."&code=".$this->code."&redirect_uri=".urlencode($this->callback);
    $str = $this->visit_url($url);
    parse_str($str,$arr);
    return $arr;
  }

This is a QQ login class, used for the QQ login interface,

php-qq login class, the class has been encapsulated, used for the QQ login callback page. app_id, app_key, callback

You need to go to the QQ Internet documentation to understand the QQ access process. This type only encapsulates the callback function.

Request the URL address, get the return string, convert the string into a format that can be json_decoded, and get the page return value through curl.



Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn

Related Article

24 useful PHP class libraries to share, 24php class libraries_PHP tutorial 24 useful PHP class libraries to share, 24php class libraries_PHP tutorial

13 Jul 2016

24 useful PHP libraries to share, 24php libraries. 24 useful PHP libraries to share, 24php libraries Currently, PHP is the most popular scripting language used for web development. You can easily find a lot of information about PHP on the Internet, including documentation, tutorials,

15 Very Practical Open Source PHP Class Libraries, 15 Open Source Class Libraries_PHP Tutorial 15 Very Practical Open Source PHP Class Libraries, 15 Open Source Class Libraries_PHP Tutorial

13 Jul 2016

15 very practical open source PHP libraries, 15 open source libraries. 15 very practical open source PHP class libraries, 15 open source class libraries The PHP library provides developers with a standard interface, which helps developers make full use of object-oriented programming in PHP. These libraries are specific

20 Very Useful PHP Class Libraries_PHP Tutorial 20 Very Useful PHP Class Libraries_PHP Tutorial

15 Jul 2016

20 extremely useful PHP libraries. Below are some very useful PHP libraries, which I believe can provide a better and faster method for your WEB development. Chart libraries The following libraries allow you to easily create complex charts.

PHP common class organization_PHP tutorial PHP common class organization_PHP tutorial

21 Jul 2016

Compilation of common php classes. Chart Libraries The following libraries make it easy to create complex charts and graphics. Of course, they require support from the GD library. pChart - A library for creating statistical charts. Libchart -

PHP calls the dll class library method developed by C#, _PHP tutorial PHP calls the dll class library method developed by C#, _PHP tutorial

13 Jul 2016

PHP calls the dll class library method developed in C#. PHP calls dll class library methods developed in C#. Sometimes, we need to use dll class libraries written in other languages ​​in php, such as dlls written in C#. The method is to use the PHP new COM method to call.

Recommended 25 very useful class libraries in PHP, 25 non-Chinese class libraries in PHP_PHP Tutorial Recommended 25 very useful class libraries in PHP, 25 non-Chinese class libraries in PHP_PHP Tutorial

13 Jul 2016

Recommend 25 very useful class libraries in PHP and 25 non-Chinese class libraries in PHP. Recommended 25 very useful class libraries in php, 25 non-class libraries in php Snappy Snappy is PHP5 used to generate thumbnails, snapshots, PDF, URL or HTML pages. It uses the excellent WebKit-based wkht

See all articles