-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgetGameDVR.php
executable file
·46 lines (39 loc) · 1.25 KB
/
getGameDVR.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
#!/usr/bin/php
<?php
define("AUTHCACHE", "/tmp/auth_info");
define("XUIDCACHE", "/tmp/xuid");
define("EXPIRES", "/tmp/session_expires");
require_once 'XboxLiveClient.php';
if (file_exists(AUTHCACHE) && file_exists(XUIDCACHE)) {
$xuid = file_get_contents(XUIDCACHE);
$authorization_header = file_get_contents(AUTHCACHE);
try {
$live = XboxLiveClient::withCachedCredentials($xuid, $authorization_header);
}
catch (Exception $e) {
printf("Couldn't go with cached creds with message '%s'\n", $e->getMessage());
exit;
}
}
$screenshot_data = array();
$continue = true;
$params = array('maxItems' => '24');
do {
$screenshots = json_decode($live->fetchGameDVRClips($params));
print_r($screenshots);
exit;
foreach($screenshots->screenshots AS $screenshot) {
$screenshot_data[] = $screenshot;
}
if (!empty($screenshots->pagingInfo->continuationToken)) {
$params['continuationToken'] = $screenshots->pagingInfo->continuationToken;
}
else {
$continue = false;
}
} while ($continue);
printf("<html>");
foreach($screenshot_data AS $screenshot) {
printf("<img src=\"%s\" />\n", $screenshot->screenshotUris[0]->uri);
}
printf("</html>");