-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathteste.php
More file actions
121 lines (75 loc) · 3.31 KB
/
teste.php
File metadata and controls
121 lines (75 loc) · 3.31 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php
// session_start();
include 'src/Api.php';
// // $app_token = "o52xh7xoo7yjq62csasgnuek17cbv4sj9ugp2eeql";
// // $user_token = "q24xm4b49hlntjb1s0k7bl38v5mnspeirhgelrht0";
// //$api = new Api("http://localhost/glpi", "w4xp74y3aa59n9d1hollryxb7n34ce80i6zp0yrk0", "glpi", "glpi");
$api = new Api("http://demo.trulysystems.com/glpi/apirest.php", "ea7hdxpex2agunikllma6clophkqyoicyoubmkqjm");
$api->init("demo_br", "demo_br");
//$return = $api->initSession();
// echo "<pre>";
// var_dump($api->initSession());
// echo "</pre>";
$token_session = $api->getSessionToken($api->initSession());
// echo "dd:" . $_SESSION["session_token"];
echo "<pre>";
print_r($token_session);
// print_r($return);
// // print_r(json_decode($api->getProblem($_SESSION["session_token"])));
// // print_r($api->countProblemOpen(json_decode($api->getProblem($_SESSION["session_token"]))));
print_r(json_decode($api->getTicket($token_session)));
//print_r($api->getTicketsContent($api->getTicket($_SESSION["session_token"])));
// print_r($api->getActiveProfile($token_session));
// echo "------------";
// print_r($api->getActiveProfileName($api->getActiveProfile($token_session)));
// //print_r($api->countProblemOpen(json_decode($api->getProblem($_SESSION["session_token"]))));
echo "</pre>";
// // $feed = file_get_contents("http://trulymanager.com/v1/feed/");
// // $rss = new SimpleXmlElement($feed);
// // foreach($rss->channel->item as $entrada) {
// // $titulo = $entrada->title;
// // $link = $entrada->link;
// // echo "$titulo - $link <br>";
// // }
// //
// echo base64_encode("demo_br:demo_br");
// echo "<br>";
// $s = base64_encode("api:api123");
// $s2 = base64_encode("{api}:{api123}");
// $url = "http://tm.trulysystems.com/glpi/api/initSession";
// $cab = array(
// "Content-Type: application/json",
// //"Authorization: Basic $s2",
// "App-Token: 9d4z2xi8nh5oe3ozxvc0lenpvil6n4bwgfwidfq2w"
// );
// $curl = curl_init();
// curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
// curl_setopt($curl, CURLOPT_URL, $url);
// curl_setopt($curl, CURLOPT_HEADER, 0);
// curl_setopt($curl, CURLOPT_USERPWD, $s);
// curl_setopt($curl, CURLOPT_HTTPHEADER, $cab);
// $resposta = curl_exec($curl);
// curl_close($curl);
// print_r($resposta);
// print_r($cab);
// // curl -X GET \
// // -H 'Content-Type: application/json' \
// // -H "Authorization: Basic YXBpOmFwaTEyMw==" \
// // -H "App-Token: 9d4z2xi8nh5oe3ozxvc0lenpvil6n4bwgfwidfq2w" \
// // 'http://tm.trulysystems.com/glpi/apirest.php/initSession'
// // curl -X GET \
// // -H 'Content-Type: application/json' \
// // -H "Authorization: Basic Z2xwaTpnbHBp" \
// // -H "App-Token {f7g3csp8mgatg5ebc5elnazakw20i9fyev1qopya7}" \
// // 'http://tm.trulysystems.com/glpi/apirest.php/initSession'
// // curl -X GET \
// // -H 'Content-Type: application/json' \
// // -H "Authorization: user_token wxqft04kmuwv32ncls2whpd2e3z8l88i6yyy83itw" \
// // -H "App-Token: 9d4z2xi8nh5oe3ozxvc0lenpvil6n4bwgfwidfq2w" \
// // 'http://tm.trulysystems.com/glpi/apirest.php/initSession'
// //
// curl -X GET \
// -H 'Content-Type: application/json' \
// -H "Authorization: Basic Z2xwaTpnbHBp" \
// -H "App-Token: f7g3csp8mgatg5ebc5elnazakw20i9fyev1qopya7" \
// 'http://tm.trulysystems.com/glpi/apirest.php/initSession'