/** Retrieves the user's account details.
  *
  *
  * @return JK_Account
  *
  * @throws Exception
  * @throws JK_Exception
  * */
 public static function load()
 {
     $result = new JK_Account();
     $xml = Jabbakam::call(self::$NAME, 'details');
     $a = $xml->account;
     $result->display_name = (string) $a->display_name;
     $result->first_name = (string) $a->first_name;
     $result->last_name = (string) $a->last_name;
     $result->email = (string) $a->email;
     $result->address1 = (string) $a->address_1;
     $result->address2 = (string) $a->address_2;
     $result->address3 = (string) $a->address_3;
     $result->county = (string) $a->county;
     $result->country = (string) $a->country;
     $result->postcode = (string) $a->postcode;
     $result->mobile = (string) $a->mobile;
     $result->day_phone = (string) $a->day_phone;
     $result->company = (string) $a->company;
     return $result;
 }
 /** Calls The Jabbakam API.
  *
  *
  * @param string $method
  * @param array $params
  * @param bool $use_post
  *
  * @uses Jabbakam::call()
  * @uses $name
  * */
 protected function call($method, $params = NULL, $use_post = FALSE)
 {
     return Jabbakam::call($this->_name, $method, $params, $use_post);
 }
 /** Searches the user's cameras.
  *
  * @param string $keywords
  * @return array of Camera objects, which may be empty.
  *
  * @throws InvalidArgumentException If $keywords is NULL or empty.
  * @throws Exception
  * @throws JK_Exception
  * */
 public static function search($keywords)
 {
     if ($keywords == NULL) {
         throw new InvalidArgumentException('NULL $keywords passed to search()');
     }
     $keywords = trim($keywords);
     if (!$keywords) {
         throw new InvalidArgumentException('empty $keywords in call to search()');
     }
     self::chomp($keywords, 255);
     $result = array();
     $xml = Jabbakam::call(self::$NAME, 'search', array('keywords' => $keywords));
     foreach ($xml->cameras->camera as $c) {
         $id = (int) $c->attributes()->camera_id;
         $camera = new JK_Camera($id);
         $camera->label = (string) $c->label;
         $camera->latitude = (double) $c->location->latitude;
         $camera->longitude = (double) $c->location->longitude;
         $result[] = $camera;
     }
     return $result;
 }
 /** Retrieves detailed information for this item.
  *
  * @return object This Item
  *
  * @throws Exception
  * @throws JK_Exception
  * */
 public function details()
 {
     if ($this->deleted) {
         throw new Exception('This item has been deleted');
         return FALSE;
     }
     $xml = Jabbakam::call(self::$NAME, 'details', array('item_id' => $this->id));
     $this->note = (string) $xml->item->note;
     $this->folder_id = (int) $xml->item->folder_id;
     $this->shared = (int) $xml->item->shared;
     $this->end_datetime = (string) $xml->item->end_datetime;
     $this->camera_id = (int) $xml->item->camera_id;
     $this->label = (string) $xml->item->label;
     $this->start_datetime = (string) $xml->item->start_datetime;
     $this->thumbnail_url = (string) $xml->item->thumbnail_url;
     $this->is_snapshot = self::attrib2bool($xml->item->is_snapshot);
     $this->is_new = self::attrib2bool($xml->item->is_new);
     $this->flag = self::attrib2bool($xml->item->flag);
     return $this;
 }
 /** Creates a new folder for the user.
  *
  * @param string $name Name for the new folder. Min 3 charcters.  Max 64 characters.
  * @param int $parent_id The id of an exisiting folder that the new folder will be a child of.  Default is 0, which indicates the new folder will be
  * a top level folder.
  * @return object|bool A JK_Folder Instance, or FALSE on failure.
  *
  * @throws InvalidArgumentException
  * @throws Exception
  * @throws JK_Exception Including if the user already has a folder with the same name
  * */
 public static function create($name, $parent_id = 0)
 {
     if ($name == NULL) {
         throw new InvalidArgumentException('NULL $name passed to create()');
         return FALSE;
     }
     $name = trim($name);
     $l = strlen($name);
     if ($l < self::NAME_MIN_LENGTH || $l > self::NAME_MAX_LENGTH) {
         throw new InvalidArgumentException('$name is invalid length in call to create()');
     }
     if ($parent_id < 0) {
         throw new InvalidArgumentException('Invalid $parent_id passed to create()');
         return FALSE;
     }
     $xml = Jabbakam::call(self::$NAME, 'create', array('name' => $name, 'parent_id' => $parent_id), TRUE);
     if (!$xml) {
         return FALSE;
     }
     $f = $xml->folder;
     if (!$f) {
         return FALSE;
     }
     $id = $f->attributes()->folder_id;
     $name = (string) $f;
     return new JK_Folder($id, $name, $parent_id);
 }
<?php

session_start();
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
require '../jabbakam/jabbakam.inc.php';
$JK = Jabbakam::requestAuthorisation();
print_r($JK);
if (isset($JK->key) && isset($JK->secret)) {
    // save the token secret for use later
    $_SESSION['oauth_token_secret'] = $JK->secret;
    // NOTE: use $JK->send() instead, I am just outputting so I can see the constructed URL
    $url = $JK->getAuthURL();
    echo 'URL = <a href="' . $url . '">' . $url . '</a><BR>';
} else {
    echo "Failed to get request token<BR>";
}
<?php

session_start();
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
require '../jabbakam/jabbakam.inc.php';
$key = $_SESSION['oauth_token_key'];
$secret = $_SESSION['oauth_token_secret'];
$User = new JK_UserAuthorisation($key, $secret);
Jabbakam::init($User);
echo "Key = {$key}, Secret = {$secret}<BR>\n";
echo "<hr />\n";
$account = JK_Account::load();
var_dump($account);
echo "<hr />\n";
$camera_list = JK_Camera::getList();
var_dump($camera_list);