-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.php
48 lines (40 loc) · 1.14 KB
/
test.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
<?php
use HuaweiUSB\API;
use HuaweiUSB\Login;
use HuaweiUSB\Controllers\Device;
use HuaweiUSB\Controllers\SMS;
require 'vendor/autoload.php';
$a = new API("192.168.67.1");
// getDeviceConfig does not need auth
$d = new Device($a);
// var_dump($d->getDeviceConfig());
$a->usingPassword('adminadmin');
if ($a->isLoggedIn()) {
print "yay, logged in still\n";
} else {
print "poop, not logged in\n";
$l = new Login($a);
$l->login();
if (!$a->isLoggedIn()) {
throw new \Exception("Could not log in");
}
}
$s = new SMS($a);
$delstored = false;
$loops = 10;
while ($loops-- > 0) {
$stored = $s->getStoredSMSs();
// print "I found " . count($stored) . " with $loops remaining\n";
foreach ($stored as $m) {
print "Message ID " . $m->Index . " was from " . $m->Phone . ", saying '" . $m->Content . "' ";
if ($delstored) {
print "Deleting it - Response is " . json_encode($s->delSms($m->Index));
}
print "\n";
}
usleep(50000);
}
exit;
// Send SMS's like this
$s->sendSms(["+61402111222", "+61402222333"], "Message to multiple");
$s->sendSms("+61402333333", "Message to Single");