Page 1 of 1

sending SMS from computer via mikrotik RB?

Posted: Tue May 28, 2013 9:19 am
by David1234
I want to know if it is possible to send a command from the computer to send SMS ?
does it make sence what I want?

Odp: sending SMS from computer via mikrotik RB?

Posted: Tue May 28, 2013 9:30 am
by ohara
Yes it is possible in many ways. You can do it with winbox, ssh or php api. You could even develop your own sms sender application with .net and api.

Re: sending SMS from computer via mikrotik RB?

Posted: Tue May 28, 2013 2:14 pm
by rainmaker
yes but how can l do that.
Currently using sms service provider.

how to l modified the following api to work with sending sms using Mikrotik.

** Name: api_sendsms
** Description: This function is used to send a SMS messages to a mobile phone.
** You can call your SMS gateway to send a message to a mobile phone.
** The function includes an example code of integrating the
** HTTP -> SMS gateway.
** >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
** Syed Jahanziab > I have changed it to use my local sms gateway running on KANNEL , Configured on same box where RM is installed and connected TELTONIKA GSM MODEM with it in VM.
** >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
** Input: $mode - SMSMODE_ACCVERIFY: send verification code
** SMSMODE_WELCOME: send account data
** SMSMODE_PSWCODE: send new password activation code
** SMSMODE_NEWPSW: send new password
** $username - RADIUS user name
** $password - RADIUS password
** $firstname - first name of user
** $lastname - last name of user
** $address - postal address of user
** $city - city of user
** $zip - zip code of user
** $country - country of user
** $state - state of user
** $phone - phone number of user
** $mobile - mobile number of user
** $email - email address of user
** $srvid - associated service id
** $verifycode - the verification code to send
** $errmsg - pointer to error message returned by the gateway
** Output: True if API succeeded or false
function api_sendsms($mode, $username, $password, $firstname, $lastname, $address, $city, $zip, $country, $state, $phone, $mobile, $email, $srvid, $verifycode, &$errmsg)
// enter your local sms http gateway credentials here

$api_user = "kannel";
$api_password = "kannel";

switch ($mode)
$body = "Enter the following verification code in Client service Center: $verifycode";

$body = "Welcome new user! Your user name is $username, your password is $password";

$body = "New password activation code: $verifycode";

$body = "Your new password: $password";

// return success (uncomment the following lines in testing environments only)

// print $body;
// return true;

// implement your own SMS gateway in the following block

$body = rawurlencode($body);
$ch = curl_init();
// change the IP and id password in the below line to match your local config. syed jahanzaib
curl_setopt($ch, CURLOPT_URL, " ... text=$body");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($ch);

// uncomment this to see the result from HTTP->SMS gateway

// print $res;

if (substr($res, 0 , 4) == "ERR:")
$errmsg = $res;
return false;

// SMS sent successfully

return true;

Re: sending SMS from computer via mikrotik RB?

Posted: Tue May 28, 2013 10:51 pm
by ohara
rainmaker, the script which you copied was not intended to be used with mikrotik. These two links will give you more details, please review and if you'll have further questions feel free to ask: ... it=sms+api (PHP) ... s-gateway/ (PERL)