PHP script to Send Free SMS through mycantos
This script will help you to sent free sms using your php code. The basic needs for using this code are the following
1. Need to have Internet connection.
2. PHP with curl support.
3. Need to have an account in mycantos.com
4. Create file named ‘cookie.txt’ in the same directory where you are going to deploy the script with write permission.
After that copy the code and replace the $uid with your mycantos username, $pwd with your mycantos password , $msg with the message you need to send and $p with the mobile number to which you need to send the sms. Now you are ready to use the script Start sending sms to your dear nd near and Enjoy
.
<?php
flush();
$curl = curl_init();
$timeout = 30;
$ret = "";
$uid='YOUR USERNAME';
$pwd='YOUR PASSWORD';
$uid = urlencode($uid);
$pwd = urlencode($pwd);
$msg="YOUR MESSAGE";
$p='RECIPIENT PHONE NUMBER';
$p = urlencode($p);
$msg = urlencode($msg);
curl_setopt ($curl, CURLOPT_URL, "http://www.mycantos.com/redirect.php");
curl_setopt ($curl, CURLOPT_POST, 1);
curl_setopt ($curl, CURLOPT_POSTFIELDS, "username=" . $uid . "&password=" . $pwd . "&checklogin=1");
curl_setopt ($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($curl, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt ($curl, CURLOPT_MAXREDIRS, 20);
curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5");
curl_setopt ($curl, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt ($curl, CURLOPT_REFERER, "http://wwwd.mycantos.com/");
$text = curl_exec($curl);
curl_close($curl);
$cr = curl_init("http://wwwd.mycantos.com/myAccount.php");
curl_setopt($cr, CURLOPT_RETURNTRANSFER, true); // Get returned value as string (don’t put to screen)
curl_setopt($cr, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // Spoof the user agent
curl_setopt ($cr, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($cr, CURLOPT_COOKIEFILE, "cookie.txt"); // Use cookie.txt for READING cookies
$output = curl_exec($cr);
curl_close($cr);
//echo $output;
$cr = curl_init("http://wwwd.mycantos.com/sendSMS.php");
curl_setopt($cr, CURLOPT_RETURNTRANSFER, true); // Get returned value as string (don’t put to screen)
curl_setopt($cr, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // Spoof the user agent
curl_setopt($cr, CURLOPT_COOKIEFILE, "cookie.txt"); // Use cookie.txt for READING cookies
curl_setopt ($cr, CURLOPT_COOKIEJAR, 'cookie.txt');
$output = curl_exec($cr);
//echo $output;
curl_close($cr);
$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, "http://www.mycantos.com/sendSMStoanyone.php");
curl_setopt ($curl, CURLOPT_POST, 1);
curl_setopt ($curl, CURLOPT_POSTFIELDS, "checkSMS=1&SMSnumber=" . $p . "&SMSmessage=" . $msg);
curl_setopt ($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($curl, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt ($curl, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt ($curl, CURLOPT_MAXREDIRS, 20);
curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($curl, CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
curl_setopt ($curl, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt ($curl, CURLOPT_REFERER, "http://wwwd.mycantos.com/sendSMS.php");
$text = curl_exec($curl);
echo $text;
curl_close($curl);
?>
Home
See the related postsPHP Warning: Call-time pass-by-reference has been deprecated Working with Database (MySQL) Cookies in PHP Session Management Functions in php Join array elements with a string – implode |




