Многие платные SMS API доступны в Интернете.
Здесь я использую SmsHorizon
// Replace with your username
$ user = "yourname";
// Replace with your API KEY (We have sent API KEY on activation email, also available on panel)
$ apikey = "ABCBEFGH786756";
// Replace if you have your own Sender ID, else donot change
$ senderid = "WEBSMS";
// For Plain Text, use "txt" ; for Unicode symbols or regional Languages like hindi/tamil/kannada use "uni"
$ type = "txt";
// Database Configuration
$ con = mysql_connect ("143.114.0.49", "username", "password");$ con_db = mysql_select_db ("db_name", $ con);
/***********************Over Speed Alert***/ //Run every 1 minute
$i = 0;
$message = "2 Week Before Expiry Alert.\n" ;
$device_query = mysql_query("SELECT * FROM table_name); // Write whatever the query you've required.
while($device_value = mysql_fetch_array($device_query))
{
$message.= ""; // Content you load here.
$i++;
}
// Replace with the destination mobile Number to which you want to send sms
$mobile = array('9999999999');
// Replace with your Message content
$message = urlencode($message);
if($i > 0)
{
for($j = 0; $j < count($mobile); $j++)
{
$ch = curl_init("http://smshorizon.co.in/api/sendsms.php?user=".$user."&apikey=".$apikey."&mobile=".$mobile[$j]."&senderid=".$senderid."&message=".$message."&type=".$type."");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//$output = curl_exec($ch);
if(curl_errno($ch))
{
echo 'Curl error: ' . curl_error($ch);
}
curl_close($ch);
// Display MSGID of the successful sms push
//echo $output;
}
}
Надеюсь, это поможет вам.