<?php

include_once "config.php";

$json_smsdata=[];

if ($_POST['st_mobile']) {

    //$class_name = $_POST['classname'];

    $smstxt=$_POST['txt_sms'];
    $mobile_number=$_POST['st_mobile'];

    for($i=0;$i<count($mobile_number);$i++){
//$sms_txt=mysqli_real_escape_string($link,$smstxt[$i]);
$message = rawurlencode($smstxt[$i].'\nbpatcsc');
$number=$mobile_number[$i];
$json_smsdata[]= ['to'=>$number,'message'=>$message];

    }

    $smsdata = json_encode($json_smsdata);



	
// // আমরা $to তে সব নাম্বার কমা সেপারেট করা অবস্থায় পেয়েছি এবার এসএমএস প্রেরন করুন
$token = "d28c64966d30bb80787a063d678a85bc";
$smsdata = $smsdata;

//$url = "http://api.greenweb.com.bd/api2.php";
$url = "http://api.greenweb.com.bd/api.php";


$data= array(
'smsdata'=>"$smsdata",
'token'=>"$token"
); // Add parameters in key value
$ch = curl_init(); // Initialize cURL
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_ENCODING, '');
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$smsresult = curl_exec($ch);

//Result
echo $smsresult;

//Error Display
echo curl_error($ch);  
 






}









?>



