Location: PHPKode > scripts > Voip Based SMS > sms/index.php
<?php 
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>kkonline.org - Inspiring Life... - Send SMS</title>
<meta name="description" content="Send SMS using web API" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="charCount.js"></script>
<script type="text/javascript">
	$(document).ready(function(){	
		//default usage
		$("#msg").charCount();
		});
</script>

<style>
body {
	margin:0;
	padding:20px 40px;
	background:#fff;
	font:80% Arial, Helvetica, sans-serif;
	color:#555;
	line-height:180%;
}
h1{
	font-size:180%;
	font-weight:normal;
	}
h2{
	font-size:160%;
	font-weight:normal;
	}	
h3{
	font-size:140%;
	font-weight:normal;
	}	
pre{
	display:block;
	font:12px "Courier New", Courier, monospace;
	padding:10px;
	border:1px solid #bae2f0;
	background:#e3f4f9;	
	margin:.5em 0;
	width:500px;
	}		
.clear{
	clear:both;
	}	
img{border:none;}
	
/* Character Count styles */	

form{width:500px;}
label{
	display:block;
	font-size:14px;
	}
textarea{
	width:490px;
	height:60px;
	border:2px solid #ccc;
	padding:3px;
	color:#555;
	font:16px Arial, Helvetica, sans-serif;
	}
input{
	border:2px solid #ccc;
	padding:3px;
	color:#555;
	font:16px Arial, Helvetica, sans-serif;
	}
form div{position:relative;margin:1em 0;}
form .counter{
	position:absolute;
	right:0;
	top:0;
	font-size:20px;
	font-weight:bold;
	color:#ccc;
	}
form .warning{color:#600;}	
form .exceeded{color:#e00;}	

</style>
</head>';

$username='username';
$password=password;
$callerid='+919582200062';

echo "<body>";
echo '<form id="form" method="post">';     
		echo '<h2>Send SMS</h2>
        <div>
        	<label for="text">Phone Number</label>
        <input type="text" name="to"><br />
	<label for="text">Security Code</label>
        <input type="password" name="code"><br />
        	<label for="message">Type your message</label>
        	<textarea id="msg" name="text"></textarea>
<input type="hidden" name="callerid" value="+919582212156">
        	<input type="submit" name="submit" value="Send SMS">
        </div>
    </form>';
$url="https://www.actionvoip.com/myaccount/sendsms.php?username=".$username."&password=".$password."&from=".$callerid."&to=".$_POST['to']."&text=".urlencode($_POST['text'])."&callerid=".$callerid;
//

if(isset($_POST['submit']) && $_POST['code']==security684) {
//echo $url;
echo 'Sending SMS...';
$curl_connection = curl_init($url);
 
//set options
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl_connection, CURLOPT_USERAGENT,
  "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);
 
//perform our request
$result = curl_exec($curl_connection);
 
//show information regarding the request
//print_r(curl_getinfo($curl_connection));
//print_r(curl_getinfo($curl_connection, CURLINFO_HTTP_CODE));
//echo curl_errno($curl_connection) . '-' . curl_error($curl_connection);
//close the connection
curl_close($curl_connection);

if (preg_match("/success/i", $result)) {
  echo "<font color='green'>Successful</font>";
} else {
  echo "<font color='red'>Failed</font>";
}
}//if loop to check submit and security code
if(isset($_POST['submit']) && $_POST['code']!=security684)
{
echo "Invalid Secutity Code";
}
?>
</body>
</html>


Return current item: Voip Based SMS