1. Go to this page and download the library: Download lox24eu/lox24_api_client 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/ */
lox24eu / lox24_api_client example snippets
// Send an SMS using LOX24's REST API and PHP
tp\Psr7\HttpFactory as GuzzleRequestFactory;
use lox24\api_client\api\Lox24Api;
use lox24\api_client\api\sms\SmsItemRequest;
use lox24\api_client\Client;
use lox24\api_client\Config;
use lox24\api_client\exceptions\access\AccessException;
use lox24\api_client\exceptions\ApiException;
use lox24\api_client\exceptions\ClientException;
use lox24\api_client\exceptions\resource\ResourceException;
use lox24\api_client\exceptions\service\ServiceException;
$token = 'your_token_here';
$config = new Config($token);
$httpClient = new GuzzleClient();
$requestFactory = new GuzzleRequestFactory();
$client = new Client($httpClient, $requestFactory, $config);
$api = new Lox24Api($client);
$sms = new SmsItemRequest(
'sender',
'+1234567890',
'sms text'
);
try {
$response = $api->sms()->sendSms($sms, true);
echo "ID: {$response->getId()}\n";
echo "Price: {$response->getPrice()}";
} catch (AccessException $e) {
echo "Access error: {$e->getMessage()}\n";
} catch (ResourceException $e) {
echo "Resource error: {$e->getMessage()}\n";
} catch (ServiceException $e) {
echo "Service error: {$e->getMessage()}\n";
} catch (ClientException $e) {
echo "Client error: {$e->getMessage()}\n";
} catch (ApiException $e) {
echo "Server error: {$e->getMessage()}\n";
}
try {
// Code that interacts with the SMS Gateway Client
} catch (ApiException $e) {
// Handle all exceptions derived from ApiException
error_log($e->getMessage());
// Additional error handling...
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.