如何从mysql中获取电话号码并在php中使用API​​发送短信?

Hi im trying to fetch the phone from db mysql and i want to send sms to that number using SMSgateway API. i have written some code pls check and tell me where im going worng im new to this sms concept

code:

   $user = "username";
   $password = "password";
   $baseurl = "https://login.smsgatewayhub.com";

   //$text = urlencode($_POST['message']);
   //$to = $_POST['to'];
   $sender = "107229";
   $format ="text";
   $reqid = "1";

enter code here

   $data = mysql_query("  SELECT value from  customer_address_entity_varchar where a   ttribute_id=17") or die(mysql_error());                                                  
   while($info = mysql_fetch_array( $data )) 
   { 

my api this is the code have used but its not working pls help me to resolve it im stuck here for very long

Change your query as

$data = mysql_query(
         "SELECT value 
           from customer_address_entity_varchar 
           where attribute_id=17") 
        or die(mysql_error());                                                  

Here is how to use twilio API to send SMS:

require_once('Services/Twilio.php'); 
$sid = "XXXX"; 
$token = "XXXX"; 
$client = new Services_Twilio($sid, $token);
$callFrom='+15553334444'; 
$callTo='+15551112222';
$myMessage='My SMS message.';
$message = $client->account->sms_messages->create($callFrom, $callTo, $myMessage, array());
echo $message->sid;