Jump to content

SMS


Recommended Posts

Hi,

 

Is the following a reasonable way to loop through database and send out sms, or are there better ways to go about it?

 

 

	$sql = mysql_query("SELECT * FROM calendar WHERE sendtxt = 1"); 
while ($row = mysql_fetch_array($sql)){
$user = '###';
$password = '###';
$api_id = '###';
$baseurl ="http://api.clickatell.com";
$text = urlencode("This is an example message");
$to = "".$row['cellphone']."";
$url = "$baseurl/http/auth?user=$user&password=$password&api_id=$api_id";
$ret = file($url);
$sess = split(":",$ret[0]);
if ($sess[0] == "OK") {
$sess_id = trim($sess[1]);
$url = "$baseurl/http/sendmsg?session_id=$sess_id&to=$to&text=$text";
$ret = file($url);
$send = split(":",$ret[0]);
if ($send[0] == "ID")
echo "success<br>message ID: ". $send[1];
else
echo "send message failed";
}else{
echo "Authentication failure: ". $ret[0];
}
}

 

 

Thanks

Link to comment
Share on other sites

$user = '###';
$password = '###';
$api_id = '###';
$baseurl ='http://api.clickatell.com';
$text = urlencode('This is an example message');
$url = "$baseurl/http/auth?user=$user&password=$password&api_id=$api_id";
$ret = file($url);
$sess = split(":",$ret[0]);
$sess_id = trim($sess[1]);
if ($sess[0] == "OK") {
$sql = mysql_query("SELECT * FROM calendar WHERE sendtxt = 1"); 
while ($row = mysql_fetch_array($sql)){
$text = urlencode('Hi '.$row['firstname'].' message here');
$url = "$baseurl/http/sendmsg?session_id=$sess_id&to=".$row['cellphone']."&text=$text";
$ret = file($url);
}
if (!$ret)
echo 'send message failed';
else
echo 'success';
}else{
echo 'Authentication failure';
}

Link to comment
Share on other sites

Hello Bob, i used Clickatell briefly but couldnt stand it after a while.

 

itagg.com is a lot easier to use, with great support and great documentation.

 

I am using it extensively in my final major project for university and have successfully got MMS messages inserting into a db, SMS messages from phone to internet and internet to phone and WAP push working all from the documentation and a little bit of php knowledge.

 

Itagg is capable of things like location based texts, wap push, downloads, java games, voting, competitions and mailing lists!

 

:)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.