<?php
include "xlsx.php";
   
    $json_smsdata=[];
		$excel=SimpleXLSX::parse($_FILES['dynamicexcel']['tmp_name']);
		//echo "<br><br><br><br>";
		echo "<pre>";	
				$excel->dimension(2);
		$excel->sheetNames();
        $sheet=0;
		$rowcol=$excel->dimension($sheet);
                 $c=0;
                 //echo $rowcol[0];
                // echo $rowcol[1];
        if($rowcol[0]!=0 &&$rowcol[1]!=0 ){
		foreach ($excel->rows($sheet) as $key => $row) {
			 $c++;
			//print_r($row);
            $q="";
            $nCon=0;
            $number="";
            $message="";
			foreach ($row as $key => $cell) {
                if ($c>1){
                    $nCon++;
                    
if ($nCon=="1"){
    $number= $cell;
 }elseif($nCon=="2"){
    $message = rawurlencode($cell);
}

               }

				//$q.="'".$cell. "',";
                }
           
        
                if ($c>1){         
                    $json_smsdata[]= ['to'=>$number,'message'=>$message];
                                    }

        }

        $smsdata = json_encode($json_smsdata);


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

 //$smsdata = $smsdata;
// //echo $smsdata;
// $url = "http://api.smscpanel.net/g_api.php?";
// //$url = "http://api.smscpanel.net/api.php?";
// //$url = "http://api.greenweb.com.bd/api.php";


//$url = "http://api.smscpanel.net/api.php?";

$token = "d28c64966d30bb80787a063d678a85bc";
$smsdata = $smsdata;

$url = "http://api.greenweb.com.bd/api2.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);  
    

    




?>



