<?php

function send_message($s_mobile, $message) {

    $api_key='4a4de426dd5bd067';
    $secret_key = 'MTMwNGRkNDdlMzkzMjc5ZTY3YmRjYTQxMzFiNmRiMTI4NTA0ZDdiYzQzMTBkZTBkNDIxMmY0MDQzYWUyMWQ5NQ==';

    $postData = array(
        'source_addr' => 'SIKIRARI SC',
        'encoding'=>0,
        'schedule_time' => '',
        'message' => $message,
        'recipients' => [array('recipient_id' => '1','dest_addr'=>$s_mobile)]
    );

    $Url ='https://apisms.beem.africa/v1/send';

    $ch = curl_init($Url);
    error_reporting(E_ALL);
    ini_set('display_errors', 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt_array($ch, array(
        CURLOPT_POST => TRUE,
        CURLOPT_RETURNTRANSFER => TRUE,
        CURLOPT_HTTPHEADER => array(
            'Authorization:Basic ' . base64_encode("$api_key:$secret_key"),
            'Content-Type: application/json'
        ),
        CURLOPT_POSTFIELDS => json_encode($postData)
    ));

    $response = curl_exec($ch);

    if($response === FALSE){
        echo $response;
        die(curl_error($ch));
    }
    // var_dump($response);
}