<?php
require("../../config/koneksi.php");
require("../../config/function.php");
require("../../config/crud.php");
$level = $_POST['untuk'];
$pesan = $_POST['pesan'];

 $query = mysqli_query($koneksi, "select * from siswa WHERE hp<>'' AND id_kelas='$level'");
 while ($siswa = mysqli_fetch_array($query)):
							
?>

<?php
sleep(3);


$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => $setting['url_api'].'/send-message',  
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => array('message' => $pesan.' *Dikirim melalui Server Gateway '.$setting['sekolah'].'*','number' => $siswa['hp']),
));

$response = curl_exec($curl);

curl_close($curl);



?>

 <?php endwhile; ?>
 