Skip to content

Instantly share code, notes, and snippets.

@alfredfrancis
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alfredfrancis/80630bd69653ef9cc34a to your computer and use it in GitHub Desktop.
Save alfredfrancis/80630bd69653ef9cc34a to your computer and use it in GitHub Desktop.
Bulk SMS Script
<?php
include_once "alfa.sms.class.php";
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT mobilenumber from Tablename";
$phone_nos = $conn->query($sql);
$sms=new AlfaSMS();
$sms->login('username','password');
$text_message = "Hi from Alfred :)";
foreach($phone_nos as $phone_no)
{
if($sms->send($phone_no,$text_message))
{
echo "SMS sent sucessfully to $phone_no”;
}
}
$sms->logout();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment