Skip to content

Instantly share code, notes, and snippets.

@hidayat365
Last active November 20, 2015 04:44
Show Gist options
  • Save hidayat365/a5bf2875a6920b78c60c to your computer and use it in GitHub Desktop.
Save hidayat365/a5bf2875a6920b78c60c to your computer and use it in GitHub Desktop.
SMS Sender ID Helper
<?php
function referrals_sms_sender($msisdn=FALSE, $message=FALSE, $uid=FALSE)
{
global $user;
set_time_limit(0);
if ($msisdn and $message) {
// parameter
$hp = urlencode(htmlspecialchars($msisdn));
$msg = urlencode(htmlspecialchars($message));
$usr = "<user>";
$pwd = "<pass>";
$auth = MD5($usr.$pwd.$hp);
// coba panggil pakai resthelper
$app = "http://smpp.pusatsms.com:8080/web2sms/api/SendSMS.aspx";
$url = $app."?username=$usr&mobile=$hp&auth=$auth&message=".$msg;
$web = rest_helper($url);
// log sms
if ($web)
referrals_sms_logger($uid?$uid:$user->uid,$msisdn,$message,$web,time());
// tampilkan hasilnya
return $web ? $web : "Send Failed!";
} else {
return 'Parameter not Supplied';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment