Using the Xero API with PHP
Private Applications
David Pitman has contributed a PHP library for use with private applications – you can download it from GitHub
<?php
include_once "Xero.php";
define('XERO_KEY','your-key-here');
define('XERO_SECRET','your-secret-here');
$xero = new Xero(XERO_KEY, XERO_SECRET, 'xero.cer', 'xero.pem', 'xml' );
$organisation = $xero->organisation;
//echo the results back
if ( is_object($organisation) ) {
//use this to see the source code if the $format option is "xml"
echo htmlentities($organisation->asXML()) . "<hr />";
} else {
//use this to see the source code if the $format option is "json" or not specified
echo json_encode($organisation) . "<hr />";
}
?>
Private, Public & Partner Applications
A sample PHP script XeroOAuth-PHP for use with all application types.
Kohana
KohanaXero wrapper for the Kohana framework https://github.com/paulsschwarz/kohana-xero (private applications only).