1. Go to this page and download the library: Download michalkortas/sms-gate-api library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
michalkortas / sms-gate-api example snippets
declare(strict_types=1);
;
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('YOUR_PASSWORD');
$connection = new Connection($connectionOptions);
$device = new Device($connection);
echo json_encode($device->information());
declare(strict_types=1);
;
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";
}
declare(strict_types=1);
;
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);
bash
$ composer
docker run --env HUAWEI_API_PASSWORD=__PASSWORD__ --rm icetee/huawei-lte-api-php:latest Endpoints\Device informations
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.