php - How can i send sms to my database entries -


i able send sms via php in have mention mobile number everytime want same script can send sms entries stored in database . here code:

<?php  //your authentication key`enter code here` $authkey = "api key";  //multiple mobiles numbers separated comma $mobilenumber = "+919425386214";  //sender id,while using route4 sender id should 6 characters long. $senderid = "social";  //your message send, add url encoding here. $message = urlencode("test message");  //define route  $route = "04"; //prepare post parameters $postdata = array(     'authkey' => $authkey,     'mobiles' => $mobilenumber,     'message' => $message,     'sender' => $senderid,     'route' => $route ); if (isset($_post['submit'])) {  //api url $url="https://control.msg91.com/api/sendhttp.php";  // init resource $ch = curl_init(); curl_setopt_array($ch, array(     curlopt_url => $url,     curlopt_returntransfer => true,     curlopt_post => true,     curlopt_postfields => $postdata     //,curlopt_followlocation => true ));   //ignore ssl certificate verification curl_setopt($ch, curlopt_ssl_verifyhost, 0); curl_setopt($ch, curlopt_ssl_verifypeer, 0);   //get response $output = curl_exec($ch);  //print error if if(curl_errno($ch)) {     echo 'error:' . curl_error($ch); }  curl_close($ch);  echo $output; } ?> 

please can send sms clients whom contact no. stored in database

you need query code , sample code:-

<?php error_reporting(e_all); ini_set('display_errors',1); $mobilenumber = ''; $conn = mysqli_connect('localhost','root','','database name') or die (mysqli_error()); // give connection credentials here  if($conn){ $query = "select mobile_number user"; // change table name , column name accordingly.  $result = mysqli_query($conn,$query) or die(mysqli_error($conn)); if(mysqli_num_rows($result) > 0){    while($row = mysqli_fetch_assoc($result)){          $mobilenumber .= $row['mobile_number'].',';    } }  } $mobilenumber = substr($mobilenumber,0,strlen($mobilenumber)-1); // have mobile numbers in , seperated form in variable 

note:- can add code in current php code , changes accordingly , output want.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -