Example #1
1
<?php

include_once "src/CamooSms.php";
/**
 * @Brief Send a sms
 *
 */
// Step 1: Declare new CamooBulkSms.
$oSMS = new CamooSms('api_key', 'secret_key');
// Step 2: Use sendText( $to, $from, $message ) method to send a message.
$orSMS = $oSMS->sendText('+237612345678', 'YourCompany', 'Hello kmer world!');
// Optional
// Step 3: Display an overview of the message
echo $oSMS->displayOverview($orSMS);
// Done!
Example #2
1
<?php

include_once "src/CamooSms.php";
/**
 * @Brief read current balance
 *
 */
// Step 1: Declare new CamooSms.
$oSMS = new CamooSms('api_key', 'secret_key');
var_export($oSMS->getBalance());
// output:
/*
stdClass Object
(
    [message] => OK
    [balance] => stdClass Object
        (
            [balance] => 910
            [currency] => XAF
        )

)*/
Example #3
0
<?php

include_once "src/CamooSms.php";
/**
 * @Brief recharge user account
 * Only available for Mobile Money MTN Cameroon Ltd
 */
// Step 1: Declare new CamooSms.
$oSMS = new CamooSms('api_key', 'secret_key');
var_export($oSMS->topup(['phonenumber' => '671234567', 'amount' => 4000]));
// output:
/*
stdClass Object
(
    [message] => pending
    [topup] => stdClass Object
        (
            [payment_id] => 40
            [completed] => 0
        )

    [code] => 200
)

// Step2 :
    - Dial *126*1#
    - Choose option to authorize the transaction
    - Enter your MTN Mobile Money PIN
    - Choose the option to approve the Payment
    - Choose option and confirm  
*/