Skip to content

Instantly share code, notes, and snippets.

@alfredfrancis
Last active Aug 29, 2015
Embed
What would you like to do?
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