ProfNandaa
5/1/2016 - 2:18 PM

focus-at-sms-snippets.php

<?php


//Sending Messages using sender id/short code

require_once('AfricasTalkingGateway.php');

$username   = "our-user-name";
$apikey     = "xxxxx-our-key-xxx";

// Specify your AfricasTalking shortCode or sender id
$from = "FOCUSKenya";

$gateway    = new AfricasTalkingGateway($username, $apikey);

$results = $gateway->sendMessage($recipients, $message, $from);
<?php
// Our previous code, getting details from MPesa IPN

// send SMS (AfricasTalking API)
$recipients = "+" . $_REQUEST["mpesa_msisdn"];
$message = "Dear " . $_REQUEST["mpesa_sender"] . ", we acknowledge receipt of Ksh. "  . $_REQUEST["mpesa_amt"] . " for " . $_REQUEST["mpesa_acc"] . ". Thanks for your support and God bless. FOCUS - Reaching Students Changing Nations.";
include_once("sms/send_sms.php");