Skip to content

Instantly share code, notes, and snippets.

@profnandaa
Last active May 2, 2016 08:25
Show Gist options
  • Save profnandaa/b8acba7c74ff1ae3696e00982ed7706d to your computer and use it in GitHub Desktop.
Save profnandaa/b8acba7c74ff1ae3696e00982ed7706d to your computer and use it in GitHub Desktop.
<?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");
<?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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment