Location: PHPKode > scripts > Class RouteSMS > class-routesms/class_routesms.php
<?
define(USR,'YOUR USERNAME');
define(PWD,'YOUR PASSWORD');


class sms {
	
		function sms()
		{
			$this->_sendURL = "http://203.199.162.16/bulksms/bulksms.asp?username=%s&password=%s&message=%s&mobile=%s&sender=%s&route=36&type=0";
			$this->sending_method = "fopen";
		}
	
		function send($text=NULL,$to=NULL,$from=NULL)
		{
			$text = stripslashes($text);
			$text = str_replace("\r", "", $text);  
			if(strlen($text) > 161) {
			  die("message too long");
			} 
			if (empty ($to)) {
			  die ("You not specify destination address (TO)!");
			}
			$cleanup_chr = array ("+", " ", "(", ")", "\r", "\n", "\r\n");
			$to = str_replace($cleanup_chr, "", $to);     
			
			  $comm = sprintf ($this->_sendURL,
			  USR,
			  PWD,
			  rawurlencode($text),			  
			  rawurlencode($to),  
                               rawurlencode($from));
			  return $this->_parse_send ($this->_execgw($comm));
			
			}
			
		function _execgw($command) 
		{
		  if ($this->sending_method == "fopen")
		  return $this->_fopen($command);
			  die ("Unsupported sending method!");
		}			
	
		function _fopen($command) 
		  {
		  $result = '';
		  $handler = @fopen ($command, 'r');
		  if ($handler) {
			  while ($line = @fgets($handler,1024)) {
			  $result .= $line;
		  }
			  fclose ($handler);
			  return $result;
		  } 
		  else 
		  {
			  die ("Error: Wrong PHP Version, use latest version of PHP > 4.3.0");
		  }
	    }	
		
		function _parse_send ($result) {
		  	return $result;
	    }		
}
?>
Return current item: Class RouteSMS