PHP third-party login Micro Blog Login Video Tutorial

Source: Internet
Author: User
Summary: To get new users for our web apps in the simplest way, you should never miss the PHP third-party login-Weibo video tutorial. This course takes you through the open platform of the SDK, which is available on the Weibo open platform, and quickly gets a huge amount of users.

Course Play Address: http://www.php.cn/course/400.html

The teacher's lecture style:

The teacher lively image, witty witty, witty, touching. A vivid image of the metaphor, like the finishing touch, to the students to open the door of wisdom, a proper sense of humor, attracting students to smile, such as drinking a cup of glycol wine, to the aftertaste and nostalgia, the philosopher's motto, culture of the proverbs from time and again interspersed in the middle, give people to think and alert.

The difficulty in this video is that PHP Weibo has developed:

Sina Weibo Login

The prerequisite is to implement the Saetv2.ex.class.PHP of the two files and the config.php of the sibling directory

saetv2.ex.class.php code Baidu Download it yourself.

config.php need to configure themselves

Define ("Wb_akey", ' ******** ');//This application in Sina can be  define ("Wb_skey", "*************");//This application can be completed in Sina  define ("Wb_ Callback_url ", ' ************ ');//The callback address to be filled in when applying
<button onclick= "Xinlang ()" class= "u-btn btn-wb" > Login using Weibo account </button>
function Xinlang () {            window.location.href = "<{$web _url}>/index.php/login/xinlang";        }
/      * * This is using SINA login      *      /Public Function Xinlang () {          include_once ('/xinlang/config.php ');          Include_once ('/xinlang/saetv2.ex.class.php ');          $o = new SaeTOAuthV2 (Wb_akey, wb_skey);          $code _url = $o->getauthorizeurl (wb_callback_url);          Header ("Location:". $code _url);      }
Include_once ('/xinlang/config.php ');            Include_once ('/xinlang/saetv2.ex.class.php ');            $o = new SaeTOAuthV2 (Wb_akey, wb_skey);            $keys = Array ();            $keys [' code '] = $_request[' code ');            $keys [' redirect_uri '] = Wb_callback_url;                $token = $o->getaccesstoken (' Code ', $keys);                    $c = new SaeTClientV2 (Wb_akey, Wb_skey, $token ["Access_token"]);                    $ms = $c->home_timeline (); Done                    $uid _get = $c->get_uid ();                    $uid =  $token [' uid '];                    $user _message = $c->show_user_by_id ($token [' uid ']);//Get basic information about the user by ID

And then we can use

Var_dump ($user _message);//display information about the user information displayed by the Sina interface

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.