<?php
$text_message=”Dear User Kindly Get in touch with us on 0721739878″; //The Text Message you want to send
$text = trim($text_message);
$username = ” “; //Your Account Username
$password = ” “; //Your Account Password
$postUrl = “https://www.connectmedia.co.ke/user-board/?api”;
$to=”254707339945″; //Phone Number must include the country code, e.g. for Kenyan users 2547********
$action=”send”;
$sender=”ConectMedia”; //Your Registered Unique Sender ID/Company Name, use ConectMedia as default Sender ID
$post = [
‘action’ => “$action”,
‘to’ => array($to),
‘username’ => “$username”, //Your Account Username
‘password’ => “$password”, //Your Account Password
‘sender’ => “$sender”, //Your Unique Sender ID, if you haven’t registered one with us use “ConectMedia”
‘message’ => urlencode(“$text”),//The Text Message you want to send
];
$ch = curl_init($postUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
$response = curl_exec($ch);
curl_close($ch);
echo “Return code is: $jsonarray[code]”; //Response code of the API
echo “Return message is: $jsonarray[message]”; //Response Message
echo (“$text”);
echo $sender;
echo ($to);
echo “$response”;
?>