-
Notifications
You must be signed in to change notification settings - Fork 0
/
agg_get_info.php
38 lines (38 loc) · 955 Bytes
/
agg_get_info.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
<?php
ini_set('display_errors', '1');
error_reporting(E_ALL);
require_once("/etc/auth.php");
//var_dump($_POST["ids"]);
//var_dump($_POST);
$IDs = json_decode($_POST["ids"]);
//var_dump($IDs);
$BASEURL = "http://127.0.0.1:9090/api/Items2/";
$REQUESTS = [];
$mh = curl_multi_init();
foreach($IDs as $ID){
$req = curl_init();
curl_setopt($req, CURLOPT_URL, "$BASEURL/$ID");
curl_setopt($req, CURLOPT_RETURNTRANSFER, true);
curl_setopt($req, CURLOPT_HTTPHEADER, ["Authorization: Basic $ENCODED_AUTH"]);
curl_multi_add_handle($mh, $req);
array_push($REQUESTS, $req);
unset($req);
}
do{
$status = curl_multi_exec($mh, $active);
if ($active){
curl_multi_select($mh);
}
}
while ($active && $status == CURLM_OK);
$RESPONSES=[];
foreach($REQUESTS as $req)
{
$res=curl_multi_getcontent($req);
//var_dump($res);
array_push($RESPONSES, json_decode($res));
};
echo json_encode($RESPONSES);
//$response = json_decode(curl_exec($req));
//var_dump($response);
?>