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