Location: PHPKode > scripts > mobilyws SMS > mobilyws-sms/example.php
<?php
require("mobilyws.class.php");
//#### mobilyws class usage example ####
//#######
//arabic text tested on windows-1256 encoding only and worked
//#######
//define the class
$mobily = new mobilyws("user","pass");
//send an sms
$res = $mobily->send_sms("dc.net.sa","966552463239","ãÍãÏ ÇáÔäÇÞ \n åáÇ æÇááå\ntest test test");
switch ($res) {
	case "0":
		echo "unable to connect to mobily.ws gateway";
		break;
	case "1":
		echo "Send OK!";
		break;
	case "2":
		echo "cannot sned, the account balance is empty";
		break;
	case "3":
		echo "cannot send, no enough credit";
		break;
	case "4":
		echo " cannot send, incorrect username";
		break;
	case "5":
		echo "cannot send, incorrect password";
		break;
	default:
		break;
}

//query about the current balance
//balance will come as 10:7 {account_total:account_current_credit}
$now_balance = $mobily->get_balance();
if ($now_balance['conncted']){
	echo "<br>current balance is: ". $now_balance['result'] . " credit(s)";
} else {
	echo "<br>unable to connect to mobily.ws gateway";
}
?>
Return current item: mobilyws SMS