title: SMS API Integration with PHP and data from MySQL
body: <p>I have below php API code for sending sms for my customers. <strong>The users are stored in Database. How can retrieve users from Database and pass values to PHP API code.</strong></p>
  
  <p><strong>Note</strong>: Tested from html form, If i pass single mobile no from html form sms is working For 2 users below code getting error</p>
  
  <blockquote>
    <p>{"errors":[{"code":4,"message":"No recipients
    specified"}],"status":"failure"}</p>
  </blockquote>
  
  <pre><code>&lt;?php
  
   $mobile1=$_POST["mobile1"]; //Example user from html form
   $mobile2=$_POST["mobile2"]; //Example user from html form
   $msgtxt=$_POST["msgtxt"];
         if(isset($_POST['btn1_send_msg']))
              {
  
      $apiKey = urlencode('myapiKey-ublQN4O2BcRPxXme8wvw2hzHzCpa');
  
  // Message details
  
  // $numbers = urlencode($mobile1); // is working
      $numbers = urlencode($mobile1,$mobile2);  //This is not working,I need mobile no from MySQL Database
      $sender = urlencode('PM-4STEC');
      $message = rawurlencode($msgtxt);
  
  // Prepare data for POST request
      $data = 'apikey=' . $apiKey . '&amp;numbers=' . $numbers . "&amp;sender=" . 
      $sender . "&amp;message=" . $message;
  
  // Send the GET request with cURL    
      $ch = curl_init('https://api.my-messagegatewayapi.com/send/?' . $data);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      $response = curl_exec($ch);
      curl_close($ch);
  
  // Process your response here
      echo $response;
  }
  ?&gt;
  </code></pre>