-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.php
More file actions
79 lines (43 loc) · 1.44 KB
/
test.php
File metadata and controls
79 lines (43 loc) · 1.44 KB
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
71
72
73
74
75
76
77
78
79
<html>
<head>
</head>
<body>
<?php
include 'crocodoc.php';
$croco = new Crocodoc();
$file = 'example.pdf';
$uuid = $croco->upload('example.pdf', false);
$resultUuid = json_decode($uuid);
$uuid = $resultUuid->{"uuid"};
sleep(7);
$status = $croco->getStatus($uuid);
$resultStatus = json_decode($status);
$status = $resultStatus[0]->{"status"};
//$url = "";
if(strcmp($status, 'DONE') == 0){
$userID = 1;
$userName = "testuser";
$session = $croco->createSession($uuid,$userID,$userName);
$resultSession = json_decode($session);
$session = $resultSession->{"session"};
$url="https://crocodoc.com/view/";
$url .=$session;
}
$downloadOutput = $croco->download($uuid);
$downloadOutputAnn = $croco->downloadAnnotated($uuid);
?>
<br><p><button id="submit">Read Document</button></p></br>
<script type="text/javascript" src="js/jquery-1.8.1.min.js"></script>
<script type="text/javascript">
$(document).ready("#submit").click(function() {
$('#link').attr('href','<?php echo "$downloadOutput"?>');
$('#frameview').attr('src','<?php echo "$url" ?>');});
</script>
<br><p>
<iframe name="frameview" id="frameview" src="" width="800" height="500"></iframe>
</p></br>
<br><p><button id="downloadFile">Download File</button></p></br>
<p><a href="test.html" id="link">Download</a></p>
</form>
</body>
</html>