PHP Classes

CSV to PHP Variable

Recommend this page to a friend!

      Top level forums  >  PHP Specialists  >  General  >  CSV to PHP Variable  
Subject:CSV to PHP Variable
Summary:SMS Messaging
Messages:2
Author:Anthony McDonald
Date:2009-07-04 06:55:08
Update:2009-07-05 20:02:11
 

  1. CSV to PHP Variable   Reply   Report abuse  
Picture of Anthony McDonald 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();
}
?>

There is 1 reply in this thread, which is not being displayed.
Browsing this forum thread replies is available only to premium subscribers.


Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.