-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgbapi_basic_wrapper.php
More file actions
45 lines (34 loc) · 995 Bytes
/
gbapi_basic_wrapper.php
File metadata and controls
45 lines (34 loc) · 995 Bytes
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
<?php
define("API_URL","http://api.gamebanana.com");
function GBAPI_Get($p_sItemType,$p_sItemId,$p_aFields,$p_bReturnObject=false)
{
$_sApiCall = API_URL."/Core/Item/Data";
$_sApiCall .= "?itemtype=$p_sItemType";
$_sApiCall .= "&itemid=$p_sItemId";
$_sApiCall .= "&fields=".implode(",",$p_aFields);
if ($p_bReturnObject)
{
$_sApiCall .= "&return_object=1";
}
$_jsonResponse = file_get_contents($_sApiCall);
return json_decode($_jsonResponse);
}
function GBAPI_GetMulti($p_aItemTypes,$p_aItemIds,$p_aFields,$p_bReturnObject=false)
{
$_sApiCall = API_URL."/Core/Item/Data";
foreach ($p_aFields as $_iKey => $_aFieldsGroup)
{
$p_aFields[$_iKey] = implode(",",$_aFieldsGroup);
}
$_sApiCall .= "?".http_build_query(array(
"itemtype" => $p_aItemTypes,
"itemid" => $p_aItemIds,
"fields" => $p_aFields,
));
if ($p_bReturnObject)
{
$_sApiCall .= "&return_object=1";
}
$_jsonResponse = file_get_contents($_sApiCall);
return json_decode($_jsonResponse);
}