<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SamplePhpCodes.com &#187; SMS Scripts</title>
	<atom:link href="http://www.samplephpcodes.com/category/attractive-php-codes/sms-scripts/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.samplephpcodes.com</link>
	<description>Get PHP Code Help, Sample PHP Scripts,PHP Script Demos</description>
	<lastBuildDate>Mon, 05 Apr 2010 15:39:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>PHP script to Send Free SMS through mycantos</title>
		<link>http://www.samplephpcodes.com/sample-php-codes/use-full-codes/php-script-to-send-free-sms-through-mycantos/</link>
		<comments>http://www.samplephpcodes.com/sample-php-codes/use-full-codes/php-script-to-send-free-sms-through-mycantos/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 08:47:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Attractive PHP Codes]]></category>
		<category><![CDATA[SMS Scripts]]></category>
		<category><![CDATA[Useful Codes]]></category>
		<category><![CDATA[free instant sms]]></category>
		<category><![CDATA[free sms php script]]></category>
		<category><![CDATA[free sms sender]]></category>
		<category><![CDATA[send sms api]]></category>
		<category><![CDATA[send sms php script]]></category>

		<guid isPermaLink="false">http://samplephpcodes.com/?p=127</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>This script will help you to sent free sms using your php code. The basic needs for using this code are the following<br />
<strong></strong><br />
                  1. Need to have Internet connection.<br />
<strong></strong><br />
                  2. PHP with curl support.<br />
<strong></strong><br />
                  3. Need to have an account in mycantos.com<br />
<strong></strong><br />
                  4. Create file named ‘cookie.txt’ in the same directory where you are going to deploy the script with write permission.<br />
<strong></strong><br />
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 <img src='http://www.samplephpcodes.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  .</p>
<pre class="brush: php;">&lt;?php

flush();

	$curl = curl_init();

	$timeout = 30;

	$ret = &quot;&quot;;

        $uid='YOUR USERNAME';

        $pwd='YOUR PASSWORD';

	$uid = urlencode($uid);

	$pwd = urlencode($pwd);

	$msg=&quot;YOUR MESSAGE&quot;;

		$p='RECIPIENT PHONE NUMBER';

 		$p = urlencode($p);

		$msg = urlencode($msg);

	curl_setopt ($curl, CURLOPT_URL, &quot;http://www.mycantos.com/redirect.php&quot;);

	curl_setopt ($curl, CURLOPT_POST, 1);

	curl_setopt ($curl, CURLOPT_POSTFIELDS, &quot;username=&quot; . $uid . &quot;&amp;password=&quot; . $pwd . &quot;&amp;checklogin=1&quot;);

	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, &quot;Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5&quot;);

	curl_setopt ($curl, CURLOPT_CONNECTTIMEOUT, $timeout);

	curl_setopt ($curl, CURLOPT_REFERER, &quot;http://wwwd.mycantos.com/&quot;);

	$text = curl_exec($curl);

	curl_close($curl);

	$cr = curl_init(&quot;http://wwwd.mycantos.com/myAccount.php&quot;);

	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, &quot;cookie.txt&quot;); // Use cookie.txt for READING cookies

	$output = curl_exec($cr);

	curl_close($cr);

	//echo $output; 

	$cr = curl_init(&quot;http://wwwd.mycantos.com/sendSMS.php&quot;);

	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, &quot;cookie.txt&quot;); // 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, &quot;http://www.mycantos.com/sendSMStoanyone.php&quot;);

	curl_setopt ($curl, CURLOPT_POST, 1);

	curl_setopt ($curl, CURLOPT_POSTFIELDS, &quot;checkSMS=1&amp;SMSnumber=&quot; . $p . &quot;&amp;SMSmessage=&quot; . $msg);

	curl_setopt ($curl, CURLOPT_FOLLOWLOCATION, 1);

	curl_setopt ($curl, CURLOPT_COOKIEFILE, &quot;cookie.txt&quot;);

	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, &quot;http://wwwd.mycantos.com/sendSMS.php&quot;);

	$text = curl_exec($curl);

	echo $text;

	curl_close($curl);

?&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.samplephpcodes.com/sample-php-codes/use-full-codes/php-script-to-send-free-sms-through-mycantos/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>way2sms PHP sms script</title>
		<link>http://www.samplephpcodes.com/attractive-php-codes/sms-scripts/way2sms-php-sms-script/</link>
		<comments>http://www.samplephpcodes.com/attractive-php-codes/sms-scripts/way2sms-php-sms-script/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 10:18:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SMS Scripts]]></category>
		<category><![CDATA[free sms script]]></category>
		<category><![CDATA[php sms script]]></category>
		<category><![CDATA[way2sms]]></category>
		<category><![CDATA[way2sms php client]]></category>

		<guid isPermaLink="false">http://www.samplephpcodes.com/?p=359</guid>
		<description><![CDATA[The URL – http://mobile.samplephpcodes.com/sendsms.php – can be invoked with the parameters as follows: http://mobile.samplephpcodes.com/sendsms.php?uid=9933445566&#038;pwd=password&#038;phone= 9812345678;9933445566&#038;msg=Hello+World You can also do a HTTP POST to the same URL to send the SMS. Here’s an example: Create an account on way2sms.com and use that mobile number as userid and password &#60;form method=”post” action=”sendsms.php“&#62; &#60;input type=”hidden” name=”uid” value=”userid(mobile)&#34; /&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>The URL – http://mobile.samplephpcodes.com/sendsms.php – can be invoked with the parameters as follows:</p>
<p>http://mobile.samplephpcodes.com/sendsms.php?uid=9933445566&#038;pwd=password&#038;phone= 9812345678;9933445566&#038;msg=Hello+World</p>
<p>You can also do a HTTP POST to the same URL to send the SMS. Here’s an example:</p>
<p>Create an account on way2sms.com and use that mobile number as userid and password</p>
<pre class="brush: xml;">

    &lt;form method=”post” action=”sendsms.php“&gt;
    &lt;input type=”hidden” name=”uid” value=”userid(mobile)&quot; /&gt;
    &lt;input type=”hidden” name=”pwd” value=”password” /&gt;
    &lt;input type=”hidden” name=”phone” value=”9812345678;9933445566? /&gt;
    &lt;input type=”hidden” name=”msg” value=”Hello World” /&gt;
    &lt;input type=”submit” value=”Send SMS” /&gt;
    &lt;/form&gt;
</pre>
<p>save the following code  as sendsms.php and use the above html post or the url GET method</p>
<pre class="brush: php;">
&lt;?php
	if(!function_exists('stripos'))
	{
		function stripos($haystack, $needle, $offset = 0)
		{
			return strpos(strtolower($haystack), strtolower($needle), $offset);
		}
	}

	if ( isset($_GET['uid']) &amp;&amp; isset($_GET['pwd']) &amp;&amp; isset($_GET['phone']) &amp;&amp; isset($_GET['msg']) )
	{
		echo sendSMSToMany($_GET['uid'], $_GET['pwd'], $_GET['phone'], $_GET['msg']);
		exit;
	}
	else if ( isset($_POST['uid']) &amp;&amp; isset($_POST['pwd']) &amp;&amp; isset($_POST['phone']) &amp;&amp; isset($_POST['msg']) )
	{       $smsg=stripslashes($_POST['msg']);

		echo 'sendSMSToMany('.$_POST['uid'].','. $_POST['pwd'].','. $_POST['phone'].','.$smsg.')';
                echo sendSMSToMany($_POST['uid'], $_POST['pwd'], $_POST['phone'],$smsg);
		exit;
	}

	function sendSMSToMany($uid, $pwd, $phone, $msg)
	{
		$curl = curl_init();
		$timeout = 30;
		$ret = &quot;&quot;;

		$uid = urlencode($uid);
		$pwd = urlencode($pwd);

		curl_setopt ($curl, CURLOPT_URL, &quot;http://wwwd.way2sms.com/auth.cl&quot;);
		curl_setopt ($curl, CURLOPT_POST, 1);
		curl_setopt ($curl, CURLOPT_POSTFIELDS, &quot;username=&quot; . $uid . &quot;&amp;password=&quot; . $pwd . &quot;&amp;q=Deepika%20Padukone%20Photo%20Gallery&amp;Submit=Sign in&quot;);
		curl_setopt ($curl, CURLOPT_COOKIESESSION, 1);
		curl_setopt ($curl, CURLOPT_COOKIEFILE, &quot;cookie_way2sms&quot;);
		curl_setopt ($curl, CURLOPT_FOLLOWLOCATION, 1);
		curl_setopt ($curl, CURLOPT_MAXREDIRS, 20);
		curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt ($curl, CURLOPT_USERAGENT, &quot;Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5&quot;);
		curl_setopt ($curl, CURLOPT_CONNECTTIMEOUT, $timeout);
		curl_setopt ($curl, CURLOPT_REFERER, &quot;http://wwwd.way2sms.com/&quot;);
		$text = curl_exec($curl);

		// Check for proper login
		$pos = stripos(curl_getinfo($curl, CURLINFO_EFFECTIVE_URL), &quot;main.jsp&quot;);
		if ($pos === &quot;FALSE&quot; || $pos == 0 || $pos == &quot;&quot;)
			return &quot;invalid login&quot;;

		if (trim($msg) == &quot;&quot; || strlen($msg) == 0) return &quot;invalid message&quot;;
		$msg = urlencode($msg);
		$pharr = explode(&quot;;&quot;, $phone);
		$refurl = curl_getinfo($curl, CURLINFO_EFFECTIVE_URL);
		curl_setopt ($curl, CURLOPT_REFERER, $refurl);
		curl_setopt ($curl, CURLOPT_URL, &quot;http://wwwd.way2sms.com/jsp/InstantSMS.jsp&quot;);
		$text = curl_exec($curl);

		//echo $text; exit;

		preg_match_all('/&lt;input[\s]*type=&quot;hidden&quot;[\s]*name=&quot;Action&quot;[\s]*value=&quot;?([^&gt;]*)?&quot;/si', $text, $match);

		$action=$match[1][0]; // get custid from the form fro the Action field in the post form

		foreach ($pharr as $p)
		{
			if (strlen($p) != 10 || !is_numeric($p) || strpos($p, &quot;.&quot;) != false)
			{
				$ret .= &quot;invalid number;&quot; . $p . &quot;\n&quot;;
				continue;
			}

			$p = urlencode($p);

			curl_setopt ($curl, CURLOPT_URL, 'http://wwwd.way2sms.com/FirstServletsms?custid=');
			curl_setopt ($curl, CURLOPT_REFERER, curl_getinfo($curl, CURLINFO_EFFECTIVE_URL));
			curl_setopt ($curl, CURLOPT_POST, 1);
			curl_setopt ($curl, CURLOPT_POSTFIELDS, &quot;HiddenAction=instantsms&amp;login=&amp;pass=&amp;custid=undefined&amp;Action=&quot;.$action.&quot;&amp;MobNo=&quot;.$p.&quot;&amp;textArea=&quot;.$msg);
			$contents= curl_exec($curl);
			$_SESSION['count']++;
		}

		curl_setopt ($curl, CURLOPT_URL, &quot;http://wwwd.way2sms.com/jsp/logout.jsp&quot;);
		curl_setopt ($curl, CURLOPT_REFERER, $refurl);
		$text = curl_exec($curl);

		curl_close($curl);

		echo '##'.$contents;
		preg_match_all('/&lt;span class=&quot;style1&quot;&gt;?([^&gt;]*)?&lt;\/span&gt;/si', $contents, $match);

		if(!isset($match[1][0]) || $match[1][0]==&quot;&quot;)
		  echo 'Message can not be submitted';
		else
		  echo $match[1][0];

	}

	if ( file_exists(&quot;nusoap/nusoap.php&quot;) ) {
		require (&quot;nusoap/nusoap.php&quot;);
		if ( !class_exists(&quot;soap_server&quot;) ) {
			printUsage();
		}
	} else {
		printUsage();
	}

	$server = new soap_server();
	$server-&gt;configureWSDL('SendSMS','urn:sms');
	$server-&gt;register(&quot;sendSMSToMany&quot;,
					  array('uid' =&gt; 'xsd:string', 'pwd' =&gt; 'xsd:string', 'phone' =&gt; 'xsd:string', 'msg' =&gt; 'xsd:string'),
					  array('status' =&gt; 'xsd:string'),
					  'urn:SendSMSToMany', 'urn:sms#SendSMSToMany', 'rpc', 'encoded',
					  'Sends the same SMS to multiple phone numbers. Give your 10 digit phone number for user ID. Separate each phone number with a semicolon(\';\').');
	$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
	$server-&gt;service($HTTP_RAW_POST_DATA);

	function printUsage() {
		$nl = &quot;\r\n&quot;;
		echo &quot;invalid_request&quot; . $nl;
		//echo &quot;Usage: Refer to http://www.samplephpcodes.com for more informaiton.&quot; . $nl;
		exit;
	}
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.samplephpcodes.com/attractive-php-codes/sms-scripts/way2sms-php-sms-script/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
