php+callback+json,callback.php

session_start();

include_once( 'config.php' );

include_once( 'saetv2.ex.class.php' );

$o = new SaeTOAuthV2( WB_AKEY , WB_SKEY );

if (isset($_REQUEST['code'])) {

$keys = array();

$keys['code'] = $_REQUEST['code'];

$keys['redirect_uri'] = WB_CALLBACK_URL;

try {

$token = $o->getAccessToken( 'code', $keys ) ;

} catch (OAuthException $e) {

}

}

if ($token) {

$_SESSION['token'] = $token;

setcookie( 'weibojs_'.$o->client_id, http_build_query($token) );

$at=$token['access_token'];

?>

#person_info {

position:fixed;

left:42%;

top:17%;

width:100px !important;

height:100px !important;display:

overflow:hidden !important;

border-radius:50px !important;

box-shadow:0px 0px 6px rgba(0, 0, 0, 0.3);

}

#fadingBarsG{

position:fixed;

top:22%;

left:32%;

width:240px;

height:29px;

}

.fadingBarsG{

position:absolute;

top:0;

background-color:#2C9DE8;

width:29px;

height:29px;

-webkit-animation-name:bounce_fadingBarsG;

-webkit-animation-duration:1s;

-webkit-animation-iteration-count:infinite;

-webkit-animation-direction:linear;

-webkit-transform:scale(.3);

}

#fadingBarsG_1{

left:0;

-webkit-animation-delay:0.4s;

}

#fadingBarsG_2{

left:30px;

-webkit-animation-delay:0.5s;

}

#fadingBarsG_3{

left:60px;

-webkit-animation-delay:0.6s;

}

#fadingBarsG_4{

left:90px;

-webkit-animation-delay:0.7s;

}

#fadingBarsG_5{

left:120px;

-webkit-animation-delay:0.8s;

}

#fadingBarsG_6{

left:150px;

-webkit-animation-delay:0.9s;

}

#fadingBarsG_7{

left:180px;

-webkit-animation-delay:1s;

}

#fadingBarsG_8{

left:210px;

-webkit-animation-delay:1.1s;

}

@-webkit-keyframes bounce_fadingBarsG{

0%{ -webkit-transform:scale(1); background-color:#2C9DE8;}

100%{ -webkit-transform:scale(.3); background-color:#E04880;}

}

#thumb1 {position:absolute; float:left;left:2%;top:60px;max-height:80px;max-width:80px;}

#thumb2 {position:absolute; float:left;left:2%;top:60px;max-height:80px;max-width:80px;}

#heading{position:relative;float:left;left:10%;top:20px;font-size:16px;font-weight:bold;display:block;margin:.6em 0;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}

#desc{position:absolute;float:left;left:10%;top:110px;font-size:12px;font-weight:normal;display:block;margin:-.5em 0 .6em;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}

$.ajax({

url: "https://api.weibo.com/2/account/get_uid.json", //获取用户uid

type: "GET",

dataType: "jsonp",

data: {

access_token: " echo $at; ?>"

},

success: function(data, textStatus, xhr){

var uids = data.data.uid;

$.ajax({

url: "https://api.weibo.com/2/users/show.json", //获取用户头像

type: "GET",

dataType: "jsonp",

data: {

access_token: " echo $at; ?>",

uid:uids

},

success: function(data, textStatus, xhr){

var infoImg=data.data.avatar_large;

/* var _url=data.data.profile_url;

var str="http://weibo.com/"+_url;

document.getElementById("person_url").href=str;*/

document.getElementById("person_info").src=infoImg;

$.ajax({

url: "https://api.weibo.com/2/statuses/home_timeline.json", //获取用户微博

type: "GET",

dataType: "jsonp",

data: {

access_token: " echo $at; ?>"

},

success: function(data, textStatus, xhr){

var weibo = data.data.statuses;

var length = weibo.length;

var str= '';

var wbPages= '';

var biaozhi=1;

$.each(weibo,function(i){

w=weibo[i];

str+='

  • ';

str+='

';

str+='

';

str+='';

str+=''+w.user.profile_image_url+'';

str+='

'+w.user.screen_name+'

';

str+='

'+w.text+'

';

});

$("#wb_content").html(str);

$("ul").click(function() {

if(biaozhi==1) {

$('._wbPage').remove();

wbPages= '';

var index=$("ul").index(this);

wbPages+='

';

wbPages+=''+weibo%5Bindex%5D.user.profile_image_url+'';

wbPages+='

'+weibo[index].user.screen_name+'

';

wbPages+='

'+weibo[index].text+'

';

$(wbPages).appendTo("#wbPage");

biaozhi=0;

}

else if(biaozhi==0) {

$('._wbPage').remove();

wbPages= '';

index=$("ul").index(this);

wbPages+='

';

wbPages+=''+weibo%5Bindex%5D.user.profile_image_url+'';

wbPages+='

'+weibo[index].user.screen_name+'

';

wbPages+='

'+weibo[index].text+'

';

$(wbPages).appendTo("#wbPage");

biaozhi=1;

}

});

}

})

}

})

}

});

Back

wb_Page

} else {

?>

授权失败。

}

?>

一键复制

编辑

Web IDE

原始数据

按行查看

历史

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值