Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,67 @@ $device = new Device($connection);
echo json_encode($device->information());
```

## Send SMS

```php
<?php

declare(strict_types=1);

include 'vendor/autoload.php';

use Icetee\HuaweiAPI\Connection;
use Icetee\HuaweiAPI\Enums\ApiResponseEnum;
use Icetee\HuaweiAPI\Options\ConnectionOptions;
use Icetee\HuaweiAPI\Endpoints\Sms;

$connectionOptions = new ConnectionOptions();
$connectionOptions->setUrl('http://192.168.8.1');
$connectionOptions->setUsername('admin');
$connectionOptions->setPassword('admin');

$connection = new Connection($connectionOptions);

$sms = new Sms($connection);

$response = $sms->sendSms(['+48123456789'], 'message');

if ($response->getXmlContent()->__toString() === ApiResponseEnum::OK->value) {
echo "Success";
} else {
echo "Error";
}
```

## Get SMS list

```php
<?php

declare(strict_types=1);

include 'vendor/autoload.php';

use Icetee\HuaweiAPI\Connection;
use Icetee\HuaweiAPI\Options\ConnectionOptions;
use Icetee\HuaweiAPI\Endpoints\Sms;

$connectionOptions = new ConnectionOptions();
$connectionOptions->setUrl('http://192.168.8.1');
$connectionOptions->setUsername('admin');
$connectionOptions->setPassword('admin');

$connection = new Connection($connectionOptions);

$sms = new Sms($connection);

$response = $sms->getSmsList();

$inbox = $response->getXmlContent();

var_dump($inbox);
```

## Use with Docker (BETA)

NOTICE: It is in development. Simple calls have been resolved for now. Complex parameters such as DateTime, Enum are not resolved.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "icetee/huawei-lte-api-php",
"name": "michalkortas/sms-gate-api",
"description": "API For huawei LAN/WAN LTE Modems written in PHP",
"type": "library",
"keywords": ["Huawei LTE", "API"],
Expand Down
2 changes: 1 addition & 1 deletion examples/send_sms.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

$response = $sms->sendSms($phoneNumbers, $argv[3]);

if ($response->getXmlContent()->__toString() === ApiResponseEnum::OK) {
if ($response->getXmlContent()->__toString() === ApiResponseEnum::OK->value) {
echo "SMS was send successfully";
} else {
echo "Error";
Expand Down
2 changes: 1 addition & 1 deletion src/Endpoints/Sms.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function getSmsList(
int $ascending = 0,
int $unreadPreferred = 0
): ResponseInterface {
return $this->connection->post('sms/send-list', [
return $this->connection->post('sms/sms-list', [
'PageIndex' => $page,
'ReadCount' => $readCount,
'BoxType' => $boxType->key(),
Expand Down