-
Notifications
You must be signed in to change notification settings - Fork 3
/
dispatcher.php
40 lines (27 loc) · 1.07 KB
/
dispatcher.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
<?php
session_start();
$token = $_SESSION["token"];
try{
$ENDPOINT = "https://glibrary.ct.infn.it:3500/v2/repos/phg/accident_analyser";
$HEADER = "Authorization: ".$token;
$HEADER2 = "Content-Type: application/json";
$ch = curl_init(); // intialize curl
curl_setopt($ch, CURLOPT_URL, $ENDPOINT); // point to endpoint
//curl_setopt($ch, CURLOPT_HEADER, $HEADER); // if no headers
curl_setopt($ch,CURLOPT_HTTPHEADER,array($HEADER, $HEADER2));
curl_setopt($ch, CURLOPT_VERBOSE, '1'); // not verbal
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($ch, CURLOPT_POSTFIELDS, $body); //data
curl_setopt($ch, CURLOPT_TIMEOUT, 60);// request time out
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, '0'); // no ssl verifictaion
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, '0');
$result=curl_exec($ch);
$jsonDecoded = json_decode($result, true);
echo $result;
//echo sizeof($jsonDecoded);
}
catch(Exception $e)
{
echo $e;
}
?>