Object APEZ API

From Apez

Jump to: navigation, search

Download: APEZ.0.1.zip

The APEZ class was actually designed for use with the Zend Framework Autoloader. If you are not useing it or a compatable one you will need to include the nessary files.

//We arn't useing the framework
require_once('APEZ.php');
require_once('APEZ/Bank.php');
require_once('APEZ/Exception.php');

//ALWAYS use try around this API.
//It thows exeptions like there free.

try{

//The factory call enables creates a new APEZ
//While the factory isn't necessary in this case it is done to allow future flexibility
//The factory will take a users name or a key.
// APEZ::factory($user,$password,$validfor = 120)
$apez = APEZ::factory("Zor Zeddmore","mypass");

//Find a users key from there name:
$key = APEZ::Name2Key("Bot Merlin");

//Getting a balance
echo "Working Balance: ".$apez->Bank->Accounts->working;

//Transferring Between Accounts 
//transfer($from,$to,$amount, $comment = null);
//Will throw exception on failure/no funds;
//Example Transfers from working to spend.
$apez->Bank->transfer("working","spend",5,"Spend Me!");

//Transfer Money from an APEZ account your SL avatar
//withdraw($from,$amount,$comment = null,$notify = true)
//Will throw exception on failure/no funds;
$apez->Bank->withdraw("working",1,"1L For me.");

//Pay Money to a Secondlife Avatar
//payInWorld($from_account,$to_key,$amount,$comment=null,$notify = true)
//Will throw exception on failure/no funds;
$apez->Bank->payInWorld("working",APEZ::Name2Key("Bot Merlin"),50,"Keep Up The Work");

//Pay an account
//pay($from_account,$to_key,$amount,$to_account= "working",$comment = null,$notify = true)
$apez->Bank->pay("working",APEZ::Name2Key("Bot Merlin"),3,"working","Monneys for your APEZ account");
}catch(Exception $e){
	print_r($e);
}
Personal tools

A d v e r t i s m e n t