Having trouble figuring out how to work with API

So im building a taxi booking system working with another companies API, im just having trouble wrapping my head around it. I understand the
overall concept, i just need help with one part

STEP 1
i start with an html form that the user fills out and submits. the form fields are

NAME
PICKUP ADDRESS
PHONE NUMBER

STEP 2
?

STEP 3
Server responds. If True, show success message, if false, try again.

The API url looks something like this

http://www.domain.com/en/services/sms/call_cab/{PHONE_NUMBER}?api_key={API_KEY}&address={ADDRESS}&name={NAME}&format=xml

and returns a xml respons like so.

<sms-call-cab>
<sms-sent type=“boolean”>false</sms-sent>
<number-valid type=“boolean”>true</number-valid>
<number>15555555555</number>
</sms-call-cab>

Can anyone point me in the right direction, articles i can read, or sample code?

thanks

[FPHP]cURL[/FPHP]

Hi starlion, thanks for that. But im still a little lost as to where to start with this. Usually when i work with API, i used sample code which i can look at and wrap my head around.

Any other advice you could give?

Much appreciated

use curl to request the API’s URL. Store the result in a variable, and treat it as your XML.

This might help you : http://wiki.uniformserver.com/index.php/PHP_cURL:_GET_%26_POST

Essentially, at step 2 you have to carefully build the url to the web service.

Give that to cURL.

Tell cURL to go to that site with that url and bring back the response.

Add some error checking too – appreciate that network latency could mean you cannot immediately get through, stuff like that.

On success, take the returning xml – break it into bits and do something useful with it.

On failure, er, try again? Quit? Take some other action.

thanks cups, it makes a lot more sense now, ill just have to trial and error it till i get it right…

i found this script online which i was going to modify for my purposes

http://snipplr.com/view/19831/

is that going in the right direction?

Thanks again

Looks like it.

I guess you might get away without having to do much reading up, but once you want to do more than simple stuff you really have to bone up on it – like everything – all those CURLOPT__s mean something.

Its a very clever tool, cURL (PHPs cURL is simply one manifestation of it)