PHP code example of fortytwo / php-sdk-advanced-messaging-platform
1. Go to this page and download the library: Download fortytwo/php-sdk-advanced-messaging-platform 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/ */
fortytwo / php-sdk-advanced-messaging-platform example snippets
/**
* This Example sends an SMS to a phone number
* NOTE: If you want to test you have to replace <INSERT_TOKEN_HERE> with a valid token and <PHONE_NUMBER> with a mobile phone number including prefix (e.g 356880000001) .
*/
use Fortytwo\SDK\AdvancedMessagingPlatform\AdvancedMessagingPlatform;
use Fortytwo\SDK\AdvancedMessagingPlatform\Entities\DestinationEntity;
use Fortytwo\SDK\AdvancedMessagingPlatform\Entities\SMSContentEntity;
use Fortytwo\SDK\AdvancedMessagingPlatform\Entities\RequestBodyEntity;
// Using the Composer autoload
SMS = new SMSContentEntity();
$SMS
->setMessage('This is a test SMS message from Fortytwo.')
->setSenderId('Fortytwo');
$request = new RequestBodyEntity();
$request
->addDestination($destination)
->setSmsContent($SMS);
$response = $messaging->sendMessage($request);
echo $response->getResultInfo()->getDescription() ."\n";
} catch (\Exception $e) {
echo $e->getMessage();
}