forked from hajekmi/myjablotron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
examples.php
84 lines (66 loc) · 1.54 KB
/
examples.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
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
/*
* Class MyJablotron - JA100
* Michal Hajek <[email protected]>
* 27.1.2018
*/
include('myjablotron.class.php');
define('MY_COOKIE_FILE', '/tmp/cookies.txt'); // curl store cookies
$MyUsername = 'login'; // Set login to www.jablonet.net
$MyPassword = 'secret'; // Set password to www.jablonet.net
$MyPIN = '0000'; // Set PIN
$ja100 = new MyJablotron($MyUsername, $MyPassword);
$ja100->debug(true, 'php://stdout'); // print curl response to STDOUT
if($ja100->login() == true) {
/*
* Login success
*/
/*
* Get section on all keyboards
*/
// $arrayOutput = $ja100->getKeyboards();
// print_r($arrayOutput);
/*
* Get status of section name STATE_3 - lock or unlock
*/
// $lock = $ja100->checkStatusSection('STATE_3');
// var_dump($lock); // true => lock, false => unlock
/*
* Lock section name STATE_3
*/
// $success = $ja100->lock('STATE_3', $MyPIN);
// var_dump($success);
/*
* Lock bypass section name STATE_3
*/
// $success = $ja100->lockBypass('STATE_3', $MyPIN);
// var_dump($success);
/*
* Unlock section name STATE_3
*/
// $success = $ja100->unlock('STATE_3', $MyPIN);
// var_dump($success);
/*
* Get PGM output
*/
// $arrayPGM = $ja100->getPGM();
// print_r($arrayPGM);
/*
* Send signal to PGM output (open or close garage doors)
*/
// $success = $ja100->sendPGMSignal('PGM_1', $MyPIN);
// var_dump($success);
/*
* Get history
*/
$arrayOutput = $ja100->getHistory();
print_r($arrayOutput);
}
else {
/*
* Login fail
*/
echo $ja100->getErrors()[0]."\n";
exit(1);
}
?>