Ucapan-ucapan Selamat Idul Fitri 1444 H



connect_error) {
die(“Koneksi gagal: ” . $conn->connect_error);
}

// Menghindari serangan SQL Injection
$phone = mysqli_real_escape_string($conn, $phone);
$pesan = mysqli_real_escape_string($conn, $pesan);

// Memasukkan data ke database
$sql = “INSERT INTO keluar (phone, pesan) VALUES (‘$phone’, ‘$pesan’)”;

if ($conn->query($sql) === TRUE) {
//echo “Data berhasil dimasukkan ke database.”;

//$pesan = str_replace(“‘”,””,$pesan);
//$pesan = xss_clean($pesan);
//$pesan = trim(preg_replace(‘/\s\s+/’, ‘ ‘, $pesan));

$phone=wa($phone);

//echo “
$tgljam $id ##=> $phone >>> $pesan
“;
//$phone=”62811945222”;
//$pesan = “tes wa $tgljam”;

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => ‘https://sendmantic.com/api/create-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(
‘appkey’ => ”.$appkey.”,
‘authkey’ => ”.$authkey.”,

‘to’ => ”.$phone.”,
‘message’ => ”.$pesan.”,
‘sandbox’ => ‘false’
),

));

$response = curl_exec($curl);
// echo “

response $response

“;
curl_close($curl);
$deresponse=json_decode($response,true);

//echo $deresponse->success;
//echo “

";
// echo $response;
//print_r($deresponse);

$message_status= $deresponse['message_status'];

if($message_status=="Success"){
$terkirim=1;
echo " wa ke $phone isi pesan $pesan berhasil terkirim ";
}
if($error=="Request Failed"){
$terkirim=2;
echo " wa ke $phone isi pesan $pesan GAGAL terkirim ";
}

} else {
echo "Terjadi kesalahan: " . $conn->error;
}

// Menutup koneksi
$conn->close();

// Lakukan pemrosesan atau penyimpanan data di sini
// Contoh: Menyimpan data ke database
// $query = "INSERT INTO tabel_pesan (nomor_hp, pesan) VALUES ('$nomor_hp', '$pesan')";
// mysqli_query($koneksi, $query);

// Menampilkan pesan sukses setelah pemrosesan form
//echo "Form berhasil dikirim. Terima kasih!";

}

/*
Array
(
[success] =>
[message] => Validation errors
[data] => Array
(
[to] => Array
(
[0] => The to field is required.
)

)

)

*/

function wa($number){
$countrycode = 62;
$arr_buang = array("-","."," ",")","(","+");
$number = str_replace($arr_buang,"",$number);
$angka1 = $number[0] ;
$angka12 = substr($number, 0, 2);
if($angka1=="0"){
$nomorakhir = substr($number, 1);
$number= "$countrycode$nomorakhir";
}else if($angka1=="+"){

}else if(strlen($number)<9){ }else if($angka12=="62"){ $number= "$number"; }else if($angka1==1 or $angka1==2 or $angka1==3 or $angka1==4 or $angka1==5 or $angka1==6 or $angka1==7 or $angka1==8 or $angka1==9){ $number= "$countrycode$number"; }else{ //$number = "+$number"; } return $number; } echo "Lihat Balasan INBOX dari $hp0
klik Gambar dibawah

catt:Pergunakanlah pesan WAndengan bijak jangan melalukan tindakan yang merugikan orang lain.
";
?>



Baca Juga  Ucapan Hari Dongeng Nasional

Check Also

Puisi Hari Minggu yang Indah

Hari Minggu tiba, mentari berseri, Langit biru memeluk bumi dengan lembut, Sejuk embun pagi merangkak …

Leave a Reply