Written on October 10, 2008 at 06:10 pm by admin

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.

3 Responses to “cURL Script to send SMS to MeroMobile(SpiceNepal) without @sms.spicenepal.com”

suman bhattarai

November 11th, 2008 7:42 pm

mero free call kina aayana 9806967390

Sovit Tamrakar

November 11th, 2008 10:34 pm

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

January 19th, 2009 9:52 pm

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?

Leave a Reply