<?php
class Sms{

    /**
     *
     * @author Shameer
     */
	
	private $username;
	public 	$password;


	public function __construct($username,$password)
	{

		$this->username	=	$username;
		$this->password	=	$password;
		//$this->sender	=	'Jihazi';
		include_once (__LIBRARY_PATH.'/sms/includeSettings.php');
	}

  

	public function setSms($msg="",$numbers="",$type="formatted",$msgKey="")
	{ 

//$msg = "عزيزي (1)، مرحبا بكم �?ي جهازي (2)";	//Message Template

//$msgKey = "(1),*,Resmi,@,(2),*,شبكة الاتصال";	/*Countervailing values, the following are the symbols details*/
		
$MsgID = rand(1,99999);					//Random number that will be attached with the posting, just in case you want to send same message in less than one hour from the first one
										//Mobily prevents recurrence send the same message within one hour of being sent, except in the case of sending a different value with each send operation										
$timeSend = 0;							//Select the time you want to send the message. 0: now
										//Standard date format is hh:mm:ss

$dateSend = 0;							//Select the date you want to send the message. 0: now
										//Standard date format is mm/dd/yyyy
										
$deleteKey = 152485;					//use this value to delete message using delete potal
										//you can specify one number for group of messages to delete
										
$resultType = 1;						//Determine the send time, 0 means send now
										//0: Returns API result as a number
										//1: Returns API result as text		
								
	
// Send templates messages
switch ($type) {
    case "formatted":
		$msg	=	utf8_encode($msg);
        echo sendSMSWK($this->username, $this->password, $numbers, $this->sender, $msg, $msgKey, $MsgID, $timeSend, $dateSend, $deleteKey, $resultType);
        break;
    default:

        // Send SMS
		echo sendSMS($this->username, $this->password, $numbers,  $this->sender, $msg, $MsgID, $timeSend, $dateSend, $deleteKey, $resultType);
}
			
			
		


			 
                 
	}
          public function curlUsingGet($page) {
      
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $page);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_TIMEOUT, 120);
        curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
        curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
        curl_setopt($ch, CURLOPT_FAILONERROR, 1);
        $output = curl_exec($ch);
        curl_close($ch);
  }

   
}