How to get data from Freshbooks API via PHP
Hi I am new to Freshbooks and I want something very simple.
I want my customer to enter either email or firstname and lastname into fields and I want my php code to search into my Freshbook account if I have that customer if I do I want my form to pull up all his account and paste into input areas where they supposed be. Like Customer`s first name into first name a开发者_如何学Pythonrea lastname into last name area.
I tried to use; http://code.google.com/p/freshbooks-php-library/
This but I couldnt figure it out and I don
t know how to XML works so is there anybody can help me ?
Looking at the API, I believe the code might look something like below. Note that this is completely untested.
Start with a client object
//new Client object
$client = new FreshBooks_Client();
Using the listing method to get get user with specific email
//listing function definition void listing ( &$rows, &$resultInfo, [ $page = 1], [ $perPage = 25], [ $filters = array()])
//get projects, 25 per page, page 1, where project belong to client email x@x.x
$client->listing($rows,$resultInfo,1,25,array('email'=>'x@x.x'));
//dump result data
print_r($rows);
print_r($resultInfo);
Using the listing method to get get user with specific username
//listing function definition void listing ( &$rows, &$resultInfo, [ $page = 1], [ $perPage = 25], [ $filters = array()])
//get projects, 25 per page, page 1, where project belong to client username test
$client->listing($rows,$resultInfo,1,25,array('username'=>'test'));
//dump result data
print_r($rows);
print_r($resultInfo);
Hope it helps you get started.
精彩评论