-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
84 lines (78 loc) · 1.93 KB
/
index.php
File metadata and controls
84 lines (78 loc) · 1.93 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
<?php
function dump($value,$level=0)
{
if ($level==-1)
{
$trans[' ']='∴';
$trans["\t"]='⇒';
$trans["\n"]='¶;';
$trans["\r"]='⇐';
$trans["\0"]='⊕';
return strtr(htmlspecialchars($value),$trans);
}
if ($level==0) echo '<pre>';
$type= gettype($value);
echo $type;
if ($type=='string')
{
echo '('.strlen($value).')';
$value= dump($value,-1);
}
elseif ($type=='boolean') $value= ($value?'true':'false');
elseif ($type=='object')
{
$props= get_class_vars(get_class($value));
echo '('.count($props).') <u>'.get_class($value).'</u>';
foreach($props as $key=>$val)
{
echo "\n".str_repeat("\t",$level+1).$key.' => ';
dump($value->$key,$level+1);
}
$value= '';
}
elseif ($type=='array')
{
echo '('.count($value).')';
foreach($value as $key=>$val)
{
echo "\n".str_repeat("\t",$level+1).dump($key,-1).' => ';
dump($val,$level+1);
}
$value= '';
}
echo " <b>$value</b>";
if ($level==0) echo '</pre>';
}
require_once('caching.php');
$APIFunc = 'livestats';
$parameters = array(
'api_key' => 'VLS3XR4KNOEXL0J1',
'sid' => 'GSN-345493-M',
'do' => 'start_session'
);
$returnType = 'serialized';
$cacheTime = 0; //No caching needed as LiveStats
$caching = new Caching();
$caching->APICallInit($APIFunc, $parameters, $returnType, $cacheTime);
$session = unserialize($caching->getAPIResults());
//Get the session id out for the next call
$APIFunc = 'livestats';
$parameters = array(
'api_key' => 'VLS3XR4KNOEXL0J1',
'sid' => 'GSN-345493-M',
'do' => 'init_visitors',
'sess_id' => $session['sess_id']
);
$returnType = 'serialized';
$cacheTime = 0; //5No caching needed for livestats func
$caching = new Caching();
$caching->APICallInit($APIFunc, $parameters, $returnType, $cacheTime);
$LSData = unserialize($caching->getAPIResults());
dump($LSData);
?>
<html>
<head>
<title>API Caching Test Page</title>
</head>
<body>
</body>