-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathcallback.php
47 lines (42 loc) · 962 Bytes
/
callback.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
<?php
/**
* Created by PhpStorm.
* User: [email protected]
* Date: 2016/1/17
* Time: 16:16
*/
?>
<!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" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>天翼云盘</title>
</head>
<body>
</body>
</html>
<?php
session_start();
include_once( 'config.php' );
include_once( 'sky.class.php' );
$re=new Sky(WB_AKEY , WB_SKEY);
if (isset($_REQUEST['code'])) {
$keys = array();
$keys['code'] = $_REQUEST['code'];
$keys['redirect_uri'] = WB_CALLBACK_URL;
try {
$token = $re->getAccessToken( 'code', $keys ) ;
} catch (OAuthException $e) {
}
}
if ($token) {
setcookie('token',$token);
?>
授权完成,<a href="sky.php">进入您的天翼云盘页面</a><br />
<?php
} else {
?>
授权失败。
<?php
}
?>