PHP code example of patrickmaken / web2sms-client

1. Go to this page and download the library: Download patrickmaken/web2sms-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/ */

    

patrickmaken / web2sms-client example snippets


use Patrickmaken\Web2Sms\Client as W2SClient;

W2SClient::setConfig([
    'api_user_id' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
    'api_key' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
]);

$telephone = '+237699887766';
$text = 'Ceci est un message de test.';
$senderID = 'MyApp';

$response = W2SClient::sendSMS($telephone, $text, $senderID);
var_dump($response);

use Patrickmaken\Web2Sms\Client as W2SClient;

W2SClient::setConfig([
    'api_user_id' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
    'api_key' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
]);

$message_id = 'e3f0bcd5-7742-433d-add2-11a00b89a477';

$response = W2SClient::getMessageStatus($message_id);
var_dump($response);
bash
array(2) {
  ["id"]=>
  string(36) "e3f0bcd5-7742-433d-add2-11a00b89a477"
  ["cost"]=>
  int(12)
}