library inmobile-php-api
Port of the InMobile PHP Api to use in Composer
markvesterskov/inmobile-php-api
Port of the InMobile PHP Api to use in Composer
- Wednesday, February 28, 2018
- by MarkVesterskov
- Repository
- 1 Watchers
- 0 Stars
- 19 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 3 Versions
- 6 % Grown
Synopsis
A simple wrapper for the Inmobile PHP API so it can be installed via Composer instead of manually., (*1)
Code Example
The API is the same as the regular API found on the Developer page on your InMobile account., (*2)
Installation
composer require MarkVesterskov\inmobile-php-api
Usage
use MarkVesterskov\InmobilePHPApi\MM_Connector;
use MarkVesterskov\InmobilePHPApi\MM_Message;
$apiKey = 'INSERT APIKEY';// Found at the top of the documentation page
// Instantiate an API client object
$MM_Connector = new MM_Connector(
$apiKey,
'https://mm.inmobile.dk', // Server root address
'http://mywebsite.com/example/messagestatus' // Optional for status callbacks
);
/*
Prepare some messages to be sent. You can repeat this step multiple times
to send multiple messages in a single http call
*/
$msg = new MM_Message(
'Hello world', // Message text
array('4512345678'), // Msisdn (phonenumber with countrycode) for the receiver
'1245'); // The sendername. This could be a phonenumber or your company name
// Optionally a send time can be specified
// $msg->setSendTime('2020-01-20 18:30:00');
$MM_Connector->addMessage($msg);
/* Send the payload */
$success = $MM_Connector->send();
if($success)
{
/* Read the message ids */
$messageIds = $MM_Connector->getMessageIds();
/*
$messageIds contains an array with message id's and its corresponding msisdn
Example:
Array
(
[0] => Array
(
[msisdn] => 4512345678
[id] => fd0ab916-e960-49d0-bb2e-361771818393
)
)
*/
print_r($messageIds);
echo 'Success!';
}
else
{
/*
This function returns the remote error code
*/
print_r($MM_Connector->getError());
echo 'Error!';
}
dev-master
9999999-dev
Port of the InMobile PHP Api to use in Composer
Sources
Download
The Requires
by
Mark Vesterskov
v2.0.3.4
2.0.3.4
Port of the InMobile PHP Api to use in Composer
Sources
Download
The Requires
by
Mark Vesterskov
dev-analysis-8Q4jNj
dev-analysis-8Q4jNj
Port of the InMobile PHP Api to use in Composer
Sources
Download
The Requires
by
Mark Vesterskov