Daftar dan Belajar Sekarang!

Menambahkan fungsi waktu pada sms gateway

foto Obby14
119 Kontribusi 7 Coto
3 hari yang lalu
selamat pagi suhu... kalo untuk menambahkan fitur waktu pada sms gateway pake apa yah? jadi sms akan terkirim otomatis setiap 3 jam sekali... ada yang bilang pakek cronjob tapi saya belum mengerti :(
<?php

session_start();
include'koneksi.php';


$tanggal = date("Y-m-d");

$telepon=$_SESSION['tlp'] ;
$message=$_SESSION['msg'];
// Script Kirim SMS Api Zenziva
$userkey = "2222222"; //userkey lihat di zenziva
$passkey = "1111111"; // set passkey di zenziva
	  
$sql 	=mssql_query( "SELECT OS_ID, OS_MESSAGE, OS_Receiver FROM OTHE_SMS WHERE OS_Receiver = '$telepon' or OS_MESSAGE = ' $message'   or  OS_FLAG=0");
while($key = mssql_fetch_array($sql)){
    
$url = "https://reguler.zenziva.net/apps/smsapi.php";
$curlHandle = curl_init();
curl_setopt($curlHandle, CURLOPT_URL, $url);
curl_setopt($curlHandle, CURLOPT_POSTFIELDS, 'userkey='.$userkey.'&passkey='.$passkey.'&nohp='.$key['OS_Receiver'].'&pesan='.urlencode($message));
curl_setopt($curlHandle, CURLOPT_HEADER, 0);
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curlHandle, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curlHandle, CURLOPT_TIMEOUT,30);
curl_setopt($curlHandle, CURLOPT_POST, 1);
$results = curl_exec($curlHandle);
curl_close($curlHandle);

						
	
		$XMLdata = new SimpleXMLElement($results);
		$status = $XMLdata->message[0]->text;

		$_SESSION['kirim'] = "kirim";
		header("location: sms_otomatis.php");
		
	}


?>

Tag: php



Login untuk diksusi di forum sekolah koding