-
Notifications
You must be signed in to change notification settings - Fork 185
/
weibolist.php
50 lines (44 loc) · 1.4 KB
/
weibolist.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
session_start();
include_once( 'config.php' );
include_once( 'saetv2.ex.class.php' );
$c = new SaeTClientV2( WB_AKEY , WB_SKEY , $_SESSION['token']['access_token'] );
$ms = $c->home_timeline(); // done
$uid_get = $c->get_uid();
$uid = $uid_get['uid'];
//根据ID获取用户等基本信息
$user_message = $c->show_user_by_id( $uid);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>新浪微博V2接口演示程序-Powered by Sina App Engine</title>
</head>
<body>
<?=$user_message['screen_name']?>,您好!
<h2 align="left">发送新微博</h2>
<form action="" >
<input type="text" name="text" style="width:300px" />
<input type="submit" />
</form>
<?php
if( isset($_REQUEST['text']) ) {
// 注意至少要带上一个链接。
$ret = $c->share( $_REQUEST['text'] ); //发送微博
if ( isset($ret['error_code']) && $ret['error_code'] > 0 ) {
echo "<p>发送失败,错误:{$ret['error_code']}:{$ret['error']}</p>";
} else {
echo "<p>发送成功</p>";
}
}
?>
<?php if( is_array( $ms['statuses'] ) ): ?>
<?php foreach( $ms['statuses'] as $item ): ?>
<div style="padding:10px;margin:5px;border:1px solid #ccc">
<?=$item['text'];?>
</div>
<?php endforeach; ?>
<?php endif; ?>
</body>
</html>