Anthony McDonald - 2009-07-04 06:59:20
I am trying to export a column of table data from MySQL into a variable for a SMS text to all phone numbers in the column. SO far I have exported the number and had them saved into a csv file. Now I would like to know how to make them a variable to send text messages to. My SMS api is below:
<?
$user = "xxxxxx";
$password = "xxxxxx";
$api_id = "xxxxxx";
$baseurl ="http://api.clickatell.com";
$mssg = $_POST["Message"];
$nmbr = $_POST["Number"];
$text = urlencode($mssg);
$to = $nmbr; <--Would like to load column data, many numbers from MySQL Row Here!!!!!!
// auth call
$url = "$baseurl/http/auth?user=$user&password=$password&api_id=$api_id";
// do auth call
$ret = file($url);
// split our response. return string is on first line of the data returned
$sess = split(":",$ret[0]);
if ($sess[0] == "OK") {
$sess_id = trim($sess[1]); // remove any whitespace
$url = "$baseurl/http/sendmsg?session_id=$sess_id&to=$to&text=$text&from=16024887811";
// do sendmsg call
$ret = file($url);
$send = split(":",$ret[0]);
if ($send[0] == "ID")
echo "success
message ID: ". $send[1];
else
echo "send message failed";
} else {
echo "Authentication failure: ". $ret[0];
exit();
}
?>