<?php
require "../../config/koneksi.php";
require "../../config/function.php";
require "../../config/crud.php";
$data = [
 'nomor' => $_POST['nomor'],
 'pesan' => $_POST['pesan'],
 'waktu' => date('d-m-Y H:i:s')
 ];

$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' => $_POST['pesan'].' '.$_POST['layanan'].' '.$_POST['balas'],'number' => $_POST['nomor']),
));


$response = curl_exec($curl);
if($response){
$exec = insert($koneksi,'pesan',$data);	
}
curl_close($curl);
echo $response;
 