Using HessianPHP with Subetha is actually pretty simple once you get Authenticated.

below you will find a simple example script that returns all mailinglists in the Subetha install

<?php
require("hessian/HessianClient.php");

$url = 'http://subetha.domain.tld/api/Admin';

$curl_options = array(
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_USERPWD => 'admin_user@domain.tld:password',
    CURLOPT_USERAGENT => 'subetha get lists script/1.0 (PHP)',
    CURLOPT_TIMEOUT => 10,
    CURLOPT_FOLLOWLOCATION => 1,
    CURLOPT_HTTPAUTH => 'CURLAUTH_BASIC',
    CURLOPT_HEADER => 0,
    CURLOPT_SSL_VERIFYPEER => false
);

$options = new HessianOptions();
$options->transport = "CURL";
$options->transportOptions = $curl_options;

class getLists{
	var $skip;
	var $count;
}

$lists = new getLists();

$proxy = new HessianClient($url, $options);
try{
    $lists=$proxy->getLists(2,5);
} catch (Exception $ex){
   // ...handle error
	echo "error: ".$ex;
	exit;
}

var_dump($lists);

as you can see. the most code is needed for the authentication afterwards it's a simple matter of calling the correct methods.

Enjoy

/var/customers/webs/cw01/wiki/data/pages/subetha/hessianphp.txt · Last modified: 2010/06/10 08:49 by wadmin
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki