December 29th, 2012, 07:35 AM
Working with an API / PHP
I'm a newbie here so be nice
I've got a fair background in website development and most PHP stuff I can work out but I seem to be struggling with working this issue out. There's a billing system that i'm using and I'm trying to create an invoice using PHP via their API
EDIT: Because I'm a "new user" i cant make posts containing urls so...
The Billing system is called XERO the api info is here:
blog . xero . com / developer / api / Invoices /
blog . xero . com / developer / getting-started / code / php /
I've honestly been hitting my head against a wall with this one, I know their API spits things out in XML but I just can't work my head around how to have a HTML form with input fields that "POST"s to their API.
Would someone be able to give me a hand in plain english please?
Thanks in advance
December 29th, 2012, 07:51 AM
Without looking at the API itself (I'm hungry and tired) you probably aren't supposed to use an HTML form to interact with it. Even less likely if they use XML.
You're supposed to have PHP talk to it. Like with cURL or SOAPClient, for example. If you need an HTML form then go ahead and have one, but it posts back to your own server, the receiving PHP script pieces together the request to the API accordingly, and deals with its response.
December 29th, 2012, 08:08 AM
Thanks for your reply requinix,
Originally Posted by requinix
Yeah that's what I gathered, one of those links i posted above is a PHP file that someone's written which I'm guessing will do the talking directly to the Xero API, I'll just make an html form that submits the correct variables to the PHP file.
I'll post back if i get stuck with any other things. Thanks again