<?php
// sms_functions.php

// Define your Zamtel API credentials here
$zamtelApiKey = 'ZTXd2G2ixsvLyAveXNnYghLle8EUOYQa';
$zamtelSenderId = 'KTCOUNCIL';


function sendZamtelSms($contacts, $message) {
    global $zamtelApiKey, $zamtelSenderId;

    $url = "https://bulksms.zamtel.co.zm/api/v2.1/action/send/api_key/$zamtelApiKey/contacts/$contacts/senderId/$zamtelSenderId/message/" . rawurlencode($message);

    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($ch);
    $err = curl_error($ch);
    curl_close($ch);

    if ($err) {
        error_log("Zamtel SMS API cURL Error: $err");
        return false;
    }
    return $response;
}





