Tampilkan postingan dengan label nixapi. Tampilkan semua postingan
Tampilkan postingan dengan label nixapi. Tampilkan semua postingan

Sabtu, 30 April 2011

fungsi kirim sms dengan nixapi

buat file bernama nixapi-function.php
isinya


function SendSMS($nixapi_username,$nixapi_password,$nixapi_url,$Phonenumbers,$Text) {


$authx = "$nixapi_username$nixapi_password$Phonenumbers";
$auth = md5($authx);

$Text=urlencode($Text);
$urlku="$nixapi_url/sendbyhttp.php?username=$nixapi_username&mobile=$Phonenumbers&message=$Text&auth=$auth";
$grab = getURL($urlku);
$agrab = explode(":",$grab);
$status = $agrab[0];

if($status=="1701"){
echo "sms siap dikirim ke $Phonenumbers";
}else{
echo "sms gagal dikirim";
}
}


function getURL($url) {
$curlHandle = curl_init(); // init curl
curl_setopt($curlHandle, CURLOPT_URL, $url); // set the url to fetch
curl_setopt($curlHandle, CURLOPT_HEADER, 0);
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curlHandle, CURLOPT_TIMEOUT,30);
curl_setopt($curlHandle, CURLOPT_POST, 0);
$content = curl_exec($curlHandle);
curl_close($curlHandle);
return $content;
}
?>

Lalu untuk kirim sms cukup dengan kode spt dibawah ini

include "nixapi-function.php";

$nixapi_username = "useranda";
$nixapi_password = "passweod";
$nixapi_url = "http://sms-gateway.web.id/Web2SMS";

$Phonenumbers = "081273880001";
$Text = "tes sms";

SendSMS($nixapi_username,$nixapi_password,$nixapi_url,$Phonenumbers,$Text);
?>


Sabtu, 12 Februari 2011

CONTOH API SMS GATEWAY UNTUK KIRIM SMS

Format Kirim SMS

http://sms-gateway.web.id/Web2SMS/sendbyhttp.php?username=xxx&mobile=xxx&messag
e=xxx&auth=xxxx


example:
http://sms-gateway.web.id/Web2SMS/sendbyhttp.php?username=demo&mobile=081273880001
&message=tes+sms+aja&auth=sf7sd8fsyf9sy388979878sfbsdsrw4werwr


keterangan :
  • username dan password kami berikan
  • mobile : nomor hp tujuan
  • auth = md5(username+password+Mobile)
CONTOH KODE PHP




$authx = "$nixapi_username$nixapi_password$mobile";
$auth = md5($authx);

$textp=urlencode($text);

$urlku="$nixapi_url/sendbyhttp.php?username=$nixapi_username&mobile=$mobile&message=$textp&auth=$auth";



$grab = getURL($urlku);


function getURL($url) {
$curlHandle = curl_init(); // init curl
curl_setopt($curlHandle, CURLOPT_URL, $url); // set the url to fetch
curl_setopt($curlHandle, CURLOPT_HEADER, 0);
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curlHandle, CURLOPT_TIMEOUT,30);
curl_setopt($curlHandle, CURLOPT_POST, 0);
$content = curl_exec($curlHandle);
curl_close($curlHandle);
return $content;
}

?>



Untuk contoh penggunaan API utk widget sms gratis klik 
http://nixsms-lab.blogspot.com/2011/02/contoh-kode-widget-sms-gratis-dengan.html