Tuesday, April 30, 2019

PHP Script Simpan Inbox WhatsTgram

Contoh script simpan inbox Whatstgram menggunakan PHP

Contoh script simpan inbox Whatstgram menggunakan PHP

<?php
ini_set('default_charset', 'UTF-8');
require_once('../include/database.config.php');

$method = $_SERVER['REQUEST_METHOD'];

if($method == 'POST'){
 $from = $_REQUEST['from'];
 $tanggal = $_REQUEST['tanggal'];
 $pengirim = $_REQUEST['pengirim'];
 $pengirim =  str_replace('pkiqf','+',$pengirim);
 $pesan = utf8_encode($_REQUEST['pesan']);

 $sql = "INSERT INTO jbssms.inbox (UpdatedInDB,ReceivingDateTime,Text,RecipientID,SenderNumber,Coding,Status)
 SELECT * FROM (SELECT N'" . $tanggal . " as UpdatedInDB', N'" . $tanggal . " as ReceivingDateTime', N'" . $pesan . "', '" . $from . "', N'" . $pengirim . "', '8bit', '0') AS tmp
 WHERE NOT EXISTS (SELECT * FROM jbssms.inbox WHERE Text='" . $pesan . "' AND SenderNumber='" . $pengirim . "' AND ReceivingDateTime='" . $tanggal . "')";

 mysql_query($sql);
}
else
{
 echo "Method not allowed";
}
?>

Post a Comment