cURL Script to send SMS to MeroMobile(SpiceNepal) without @sms.spicenepal.com
/****
Developed By:
Sovit Tamrakar
sovit.tamrakar@gmail.com
****/
// SendSMS function starts
function SendSMS($toNo,$msg){
$cookie="cookie.txt";
// Spice Nepal Login Informations
$login = "SPICENEPAL LOGIN NO"; //(Your Phone No like 9801234567)
$password = SPICENEPAL LOGIN PASSWORD; // Of 7 digits Like 1234567
$toNo=urlencode($toNo); // Lets encode form values
$msg=urlencode($msg); // Lets encode sms entry
// Note: I haven't done the sms length validation...I hope you can do it...if not...then tell me.. i shall help you :P</code>
$loginReferer="http://116.68.208.70/issa/cgi-bin/cgi.exe?function=is_newlog"; //Login Referal URL
$loginUrl = "http://116.68.208.70/issa/cgi-bin/cgi.exe?function=is_login"; //Login URL
$smsFormUrl = "http://116.68.208.70/issa/cgi-bin/cgi.exe?function=sms_send&Clear=1"; // Message Form URL
$smsPostUrl = "http://116.68.208.70/issa/cgi-bin/cgi.exe?function=sms_send"; // Message Post URL
$userAgent=$_SERVER['HTTP_USER_AGENT']; // User AGENT
$ch = curl_init(); // Init cURL
//Set cURL Options */
curl_setopt($ch, CURLOPT_URL,$loginUrl);
curl_setopt($ch, CURLOPT_USERAGENT, "");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS , "Lang=1
&mobnum=$login
&Password=$password
&x=15
&y=45" );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIESESSION, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt( $ch, CURLOPT_COOKIEJAR, $cookie );
curl_setopt( $ch, CURLOPT_COOKIEFILE, $cookie );
curl_setopt( $ch, CURLOPT_COOKIE, 0 );
$html = curl_exec($ch);
/*
// lets check if login was successful or not
if (preg_match("/invalid/i", $html)){
curl_close($ch);
echo "Not Logged In \n";
}
*/
////////////////////////////////////////////////////////////////////////////////////////////////////*/
$ts = time()+(5*60*60)+(45*60); // Set the timestamp to Nepal Standard time +5:45 Hrs...
$day=date("d",$ts);
$month=date("m",$ts);
$year=date("Y",$ts);
$minute=date("i",$ts);
$hour=date("H",$ts);
$count=strlen($msg);
// Execute cURL
curl_setopt($ch, CURLOPT_URL,$smsPostUrl);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt( $ch, CURLOPT_COOKIEJAR, $cookie );
curl_setopt($ch, CURLOPT_POSTFIELDS, "&MMObjectType=0&
MMObjectID=
&To=$toNo
&Msg=$msg
&count=$count
&Day=$day
&Mon=$month
&Year=$year
&Hour=$hour
&Min=$minute
&from=
&x=15
&y=45");
$html = curl_exec($ch);
/*
// lets check smsl limitation ...coz SpiceNepal has limit of 10 sms/day per user...
if (preg_match("/Impossible to send the message. Daily limit of free messages exceeded./i", $html)){
curl_close($ch);
echo "SMS Limit Exceeded\n";
}
*/
}
}
// SendSMS("Recipent Mobile No","message text");
SendSMS("9803333333","This is test sms");
I worked out to develop this script, but a sad news about it is that ……. spicenepal has only 10 sms/day limit……
any way…. hope you would like this script…. Please give me some comments on my work/code or if you have developed any similar scripts as mine then let me know..
Thanks.







Hi, I am Sovit Tamrakar. I am freelancer Web Developer from Nepal. I had never been blogging until one of my friend explained me the power of blogging. Since then, it has been my hobby.
9 Responses to “cURL Script to send SMS to MeroMobile(SpiceNepal) without @sms.spicenepal.com”
suman bhattarai
mero free call kina aayana 9806967390
Sovit Tamrakar
Hey Suman,
You might have not known but the Free Call disribution scheme for MeroMobile has been changed recently.
Now Free-calls are avaliable only to those subscribers that has spent more than Rs. 50 on the previous week to get 15 minutes free can the coming week. This means that you have to spend Rs.50×4=Rs. 200 per month to get the free call of 60 mins. And this time, the free call scheme has changed from per 10 days to per week with same relative validity period. I have switched to Ramro (Tariff), its cheap and this rocks!!.
Better call the customer care center at 9005 for detail about this scheme.
Best of luck!!
gantavya
how will you send a message from this code? What programs do u need? Would u please clarify? There is a website of mero mobile through which u can send the SMS. So, What is the advantage of using this script?
Sovit Tamrakar
Gantavya,
I developed this script for my educational purposes of cURL function. I don’t want anyone to use it for any kind of commercial purpose. This script basically uses the spicenepal home site’s web sms service authenticated with the user-number and password and has the limit of 10 sms per day. It requred PHP5+ to run properly with cURL enabled. If you are a PHP programmer then may be you can understand what these codes are intended to do, else please ask me and I will try to make detail note about each line of code on my next post.
Thanks for reading and showing your interest.
goutam
hi sovit acctually I don’t know php.please send me a link after upload it in website.
sulove
i need to send message for in my home country,by internet to mero mobile.
Sovit Tamrakar
@sulove .. it was easy to send sms to meromobile by mailing to 977980*******@sms.spicenepal.com but SpiceNepal has changed its SMS2Email to premium scheme. I have a script which I coded few months back but it required spicenepal’s web login details so that you can send sms. You can find various services to send free sms like wadja and so on.
devraj
oh! mr how are you? what are you doing?
Anurodh
can u pls help me to do the same for NTC wemsms…
ur kind feedback will be apprciated..
Anurodh