-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathsample.php
More file actions
40 lines (37 loc) · 1.03 KB
/
sample.php
File metadata and controls
40 lines (37 loc) · 1.03 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
<?php
require_once(dirname(__FILE__) . '/BTCChinaLibrary.php');
// Here we store accesskey and secret key in config file.
// You can hard code the key[0],key[1] here for testing.
$keys = file(dirname(__FILE__) . '/account.config', FILE_IGNORE_NEW_LINES);
echo "<html><body><form action=\"\" method=\"post\"><input type=text name=func /><input type=submit value=submit />";
if($_POST)
{
echo "<br /><pre>";
try
{
$testAPI = new BTCChinaAPI($keys[0], $keys[1]);
// testAPI can be used directly.
// Here we use eval to call the method on UI.
eval("\$res=\$testAPI->".$_POST['func']);
echo htmlspecialchars(var_dump($res));
}
catch(JsonRequestException $e)
{
echo var_dump($e->getMessage() . $e->getMethod() . $e->getErrorCode());
}
catch(ContentException $e)
{
echo var_dump($e->getMessage() . $e->getMethod() . $e->getErrorCode());
}
catch(ConnectionException $e)
{
echo var_dump($e->getMessage() . $e->getMethod() . $e->getErrorCode());
}
finally
{
unset($testAPI);
}
echo "</pre>";
}
echo "</form></body></html>"
?>