provide some PHP code samples for using the Xero API
With OAuth of course!
All our code samples are located here: http://developer.xero.com/getting-started/code/
This is not the best place to get answers on questions about PHP code and the API. Please ask your questions in our Developer Community: https://community.xero.com/developer/topic/16971/
-
Anonymous commented
ZVzvxcvcvxcvcv
-
Gerry commented
@marksolly I recommend dumping the official Xero PHP library in favour of this one: https://github.com/calcinai/xero-php
Description from the project page, which also mirrors my experience with the official library:
"A client implementation of the Xero API, with a cleaner OAuth interface and ORM-like abstraction.
I hate reinventing the wheel, but this was written out of desperation. I wasn't comfortable putting the implementation that's recommended by Xero in to production, even after persisting with extending it."
-
wineglass commented
Searching contacts with wildcard with thinktree / PHP-Xero?
How do I use wildcard searching with the php-xero class? I'm trying to search a ContactNumber with "(888) 888 888" for example.
$result = $xero->Contacts(false, false, array(ContactNumber=>"where%3DContactNumber.Contains%28%22888%22%29"));
Please give me an example for a wilcard search?
Also please give me an example for searching "(888) 888 888".I also tried %28888%29+888+888 via urlencode.
Thanks
-
Simon commented
hi
i am using the contributed xero.php from github. I have it working for adding customers and invoices. However when I use the payments function i get the following error
PHP Warning: curl_exec(): CURLOPT_INFILE resource has gone away, resetting to default in /xero.php on line 309
Using the example code given produces this error, yet it works fine for the other functions.
Any ideas as to what the issue is? -
Simon commented
has anyone got an example of php code that can be used for a xero public application?
-
Community Admin commented
Can i get the comment posting json data code.
-
-
Tim Hurrell commented
Hi David - Thanks for class!
I am having a real issue loading a new payment into xero using php. Could you spare me 5 min to tell me where I'm going wrong?
$xero = new Xero(XERO_KEY, XERO_SECRET, XERO_PUBLICKEY, XERO_PRIVATEKEY, 'xml');
$new_payment = array(array("Invoice"=>array("InvoiceNumber"=>"i00722"),"Account"=>array("Code"=>"BAR"),"Date"=>"2010-06-09","Amount"=>"0.01",));
$payment_result = $xero->Payments( $new_payment );My request times out with a message saying:
Warning: curl_setopt() [function.curl-setopt]: cannot represent a stream of type MEMORY as a STDIO FILE* in D:\home\OTRA DIA\secure.otradia.com\htdocs\_modules\xero.php on line 145The history panel in zero api says "response code 400 - Bad Request".
Many thanks,
Tim
-
David Pitman commented
In case that previous url doesn't work (github seems slow to create the project page), please try this link instead: http://github.com/thinktree/PHP-Xero
-
David Pitman commented
I have created a fully developed PHP class, including Oauth authentication. It is for Private Applications, but should also be able to be used with minor modifications for Public Applications. The class file and README includes example usage code. The code is stored at GitHub, at http://thinktree.github.com/PHP-Xero
-
sushan.senanayake commented
hi...I am trying to link the xero using http_oauth pear package. but it does not seem to work only things i get is HTTP_OAuth_Exception: Unable to connect to ssl://api.xero.com:443. Error #0: this . can figure out what I am doing wrong . any ideas ....?
-
eileen commented
Here's a start: http://snippets.dzone.com/posts/show/9623
-
Dan Rucci commented
I would like to see some decent examples of how to do this as well....
-
marksolly commented
Some examples and a working, easy to impelement oauth library for PHP would be a fantastic incentive for developers to recommend xero.