Last active
February 28, 2017 12:37
-
-
Save ianjuma/129cdf1b109faf4f678cf4de737e0850 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$from = $_POST['from']; | |
$to = $_POST['to']; | |
$text = $_POST['text']; | |
$date = $_POST['date']; | |
$id = $_POST['id']; | |
$linkId = $_POST['linkId']; | |
if(!empty($_POST['from'])) { | |
require_once('AfricasTalkingGateway.php'); | |
$username = "user"; | |
$apikey = "api_key"; | |
$message = "Great test Brian"; | |
// Specify your AfricasTalking shortCode or sender id | |
$shortCode = "22384"; | |
$gateway = new AfricasTalkingGateway($username, $apikey); | |
$options = array( | |
'keyword' => "yes", | |
'linkId' => $linkId | |
); | |
try | |
{ | |
$results = $gateway->sendMessage($from, $message, $shortCode, 0, $options); | |
foreach($results as $result) { | |
echo " Number: " .$result->number; | |
echo " Status: " .$result->status; | |
echo " MessageId: " .$result->messageId; | |
echo " Cost: " .$result->cost."\n"; | |
} | |
} | |
catch ( AfricasTalkingGatewayException $e ) | |
{ | |
echo "Encountered an error while sending: ".$e->getMessage(); | |
} | |
// DONE!!! | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment