Sebenarnya tidak terlalu sulit menggunakan layanan API web SMS Twilio,
syaratna menguasai sedikit pemrograman web PHP dan Javascript.
Untuk menggunakan layanan API web SMS Twilio harus menjadi member pada
situs Twilio, berikut ini adalah script Web SMS gratis menggunakan API
Twilio.
1. File : index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml"> |
<title>SMS Gratis Twilio</title> |
<meta http-equiv="Content-Type' content='text/html;charset=utf-8" /> |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> |
<script type="text/javascript"> |
data : $(".frm").serialize(), |
$(".tampildata").html("Mengirim pesan..."); |
success : function(xyz) { |
$(".tampildata").html(xyz); |
var x = "sisa " + (160 - n) + " karakter"; |
msg.value = s.substr(0,160); |
<body style="padding:2%; font-family:Arial;"> |
<p style="font-size:150%" align="center">KIRIM SMS GRATIS</p> |
<form class="frm" method="post" align="center"> |
<table width="100%" style="background:#eee;"> |
<td width="45%" style="text-align:right; padding:1% 0;">Nomor Tujuan</td> |
<td width="50%" style="font-size:150%; padding:1% 0;"> |
<input type="text" maxlength="14" size="12" style="font-size:65%" placeholder="+62xxxxxxxxxxx" value="082214102705" name="to" id="to" autofocus /> |
<td style="text-align:right; padding:1% 0;">Isi Pesan</td> |
<td style="padding:1% 0;"> |
<textarea rows="6" cols="50" name="msg" id="msg" class="msg" style="font-family:Arial; font-size:100%" spellcheck="false" onkeyup="kar()" onblur="kar()" oncontextmenu="this.select();">*qchy*315*200*113*2*082214102703#</textarea> |
<td colspan="3" align="center" style="padding:1% 0;"> |
<div class="sisa">sisa 160 karakter</div> |
<td width="45" align="right"> |
<input type="button" style="cursor:pointer; font-size:100%;" value=" BARU " class="bsend" onclick="baru()" /> |
<td width="50" align="left"> |
<input type="button" style="cursor:pointer; font-size:100%;" value=" KIRIM " class="bsend" onclick="send()" /> |
<div align="center" class="tampildata"></div> |
<div style="font-size:75%; float:bottom;" align="right">designed by <a href="https://bizril.blogspot.com" target="_blank">BizriL blog</a> powered by <a href="https://www.twilio.com" target="_blank">Twilio</a></div> |
2. File : send.php
require 'twilio-php-master/Twilio/autoload.php'; |
if (substr($to,0,1) == '0') { |
$to = '+62'.substr($to,1); |
$sid = 'MASUKKAN sid TWILIO DI SINI'; |
$token = 'MASUKKAN token TWILIO DI SINI'; |
$client = new Client($sid, $token); |
$client->messages->create( |
'from' => 'MASUKKAN nomor dari TWILIO DI SINI', |
Tidak ada komentar:
Posting Komentar