php的第三方登录----新浪微博
2014-12-25 17:57
239 查看
新浪微博的登录
前提条件是需要实现两个文件 saetv2.ex.class.php 和 同级目录的config.php
saetv2.ex.class.php代码 百度一下 自己下载就行
config.php需要自己配置
然后 我们就可以用
前提条件是需要实现两个文件 saetv2.ex.class.php 和 同级目录的config.php
saetv2.ex.class.php代码 百度一下 自己下载就行
config.php需要自己配置
define( "WB_AKEY" , '********' );//这个在新浪申请 填上即可 define( "WB_SKEY" ,'*************' );//这个在新浪申请 填上即可 define( "WB_CALLBACK_URL" , '************' );//申请的时候 填写的回调地址
<button onclick="xinlang()" class="u-btn btn-wb">使用微博帐号登录</button>
function xinlang(){ window.location.href = "<{$web_url}>/index.php/login/xinlang"; }
/* * 这个是用新浪登录 */ 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']);//根据ID获取用户等基本信息
然后 我们就可以用
var_dump($user_message);//显示新浪接口给我们展示的用户信息的有关资料了
相关文章推荐
- php实现新浪微博第三方信任登录
- php的第三方登录----新浪微博
- 手机第三方新浪微博登录php api实现分析
- php 新浪微博第三方登录验证/OAuth2.0
- php 新浪微博第三方登录验证/OAuth2.0
- 使用Sharesdk实现第三方平台登录(qq,新浪微博)
- php使用第三方登录
- php腾讯QQ 第三方登录 回调问题
- Android 使用第三方登录(QQ和新浪微博)
- PHP 第三方调用 UC_Center用户登录认证
- 基于第三方QQ授权登录和新浪微博授权登录的iOS代码分析
- 腾讯QQ、新浪微博第三方登录接口申请说明
- 新浪微博oAuth第三方登录代码示例
- 关于使用QQ、新浪微博、腾讯微博等第三方登录网站的开发过程(二)
- CI框架 QQ接口(第三方登录接口PHP版)
- 新浪微博开发接口_第三方登录(授权)/分享(发帖)
- 新浪微博登录接口(PHP版)
- PHP使用新浪微博登入第三方网站实例代码
- 用selenium2\htmldriver模拟第三方登录(新浪微博、qq等),取cookie
- Android 新浪微博第三方登录