SELAMAT DATANG DI WEBSITE SARJANA GAGAL

Mahasiswa VS Dosen

SMS FLASH DENGAN GAMMU & PHP

Posted on June 8, 2013 at 12:55 PM

Pertama buat file sms_flash.php script nya seperti berikut ini :

<h1>SMS FLASH </h1>

 

<form method="post" action="send_flash.php">

Nomor HP Tujuan<br>

<input type="text" name="nohp"><br><br>

Isi SMS<br>

<textarea name="sms"></textarea><br><br>

Format SMS<br>

<input type="radio" name="format" value="flash"> Flash SMS <br>

<input type="radio" name="format" value="normal"> Normal SMS <br><br>

<input type="submit" name="submit" value="Kirim SMS">

</form>


Selanjutnya buat File send_flash.php

<?php

 

// koneksi ke database Gammu, kalo ada file koneksi ga perlu di tulis

mysql_connect("dbhost", "dbuser", "dbpass");

mysql_select_db("dbname");

 

// baca no tujuan

$no_tujuan = $_POST['nohp'];

 

// baca isi sms

$isi_sms = $_POST['sms'];

 

// baca format sms

$pilih_format = $_POST['format'];

 

if ($pilih_format == "flash")

{

   // jika format yang dipilih 'flash'

 

   // query kirim sms format flash

   $query = "INSERT INTO outbox(DestinationNumber, TextDecoded, CreatorID, Class)

             VALUES ('$no_tujuan', '$isi_sms', 'Gammu', '0')";

 

   // jalankan query

   mysql_query($query);

}

else if ($pilih_format == "normal")

{

   // jika format yang dipilih 'normal'

 

   // query kirim sms normal

   $query = "INSERT INTO outbox(DestinationNumber, TextDecoded, CreatorID, Class)

             VALUES ('$no_tujuan', '$isi_sms', 'Gammu', '-1')";   

 

   // jalankan query

   mysql_query($query);

}

else echo "Anda belum memilih format SMS";

 

?>

 Terima kasih semoga bermanfaat



Categories: None

Post a Comment

Oops!

Oops, you forgot something.

Oops!

The words you entered did not match the given text. Please try again.

Already a member? Sign In

1 Comment

Reply Teddy Allg
1:34 PM on June 8, 2013 
Terimakasih Pak :)
Izin untuk copas ke word.