-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrenew.php
70 lines (61 loc) · 1.38 KB
/
renew.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<html>
<head>
<title>Renew</title>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Cutive">
</head>
<body>
<img src="logo.jpg">
<p>
<?php
include 'tokens.php';
$userName = $_POST["userName"];
$id = $_POST["id"];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://cloud-va.aerohive.com/xapi/v1/identity/credentials/$id/renew?ownerId=$ownerId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => "",
CURLOPT_HTTPHEADER => array(
"authorization: Bearer $accesstoken",
"cache-control: no-cache",
"content-type: application/json",
"x-ah-api-client-id: $clientid",
"x-ah-api-client-redirect-uri: $redirecturi",
"x-ah-api-client-secret: $clientsecret"
),
));
$response = curl_exec($curl);
$json = json_decode($response, true);
$id = $json['data']['id'];
$expireTime = $json['data']['expireTime'];
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
}
?>
<p>
<?php
echo $userName;
?>
has been renewed
<p>
credential id:
<?php
echo $id;
?>
<p>
expiration:
<?php
echo $expireTime;
?>
<p>
<a id="returnbutton" href="<?php echo $returnurl ?>">Return</a>
</body>
</html>