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+='
';});
$("#wb_content").html(str);
$("ul").click(function() {
if(biaozhi==1) {
$('._wbPage').remove();
wbPages= '';
var index=$("ul").index(this);
wbPages+='
wbPages+='';
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+='';
wbPages+='
'+weibo[index].user.screen_name+'
';wbPages+='
'+weibo[index].text+'
$(wbPages).appendTo("#wbPage");
biaozhi=1;
}
});
}
})
}
})
}
});
} else {
?>
授权失败。
}
?>
一键复制
编辑
Web IDE
原始数据
按行查看
历史