Using APIs

Soldato
Joined
7 Nov 2005
Posts
4,958
Location
Widnes
Hi guys,

Does anyone have a good, beginners guide to using APIs with php?

I need to call an API to get the data, then send it via a different API to effectively integrate two websites. I would then setup cPanel to use CURL and call the php script every night, pushing the data from one site to the other.

Thanks!
 
Assuming the third party doesn't provide an SDK to use with their API, then you appear to already have your answer; use cURL :)
Curl I use in coanel though is just setting a time and enter the URL. I don't really know how to use curl. The documentation for the APi just references the URL to call and then what is returned.
 
Curl I use in coanel though is just setting a time and enter the URL. I don't really know how to use curl. The documentation for the APi just references the URL to call and then what is returned.

cURL is quite simple - it just gets content from a URL (whatever content type the URL returns, HTML, XML, etc)
It's just the tool you use to communicate with the API. The API itself doesn't care what tool you use to communicate with it, it just needs the right parameters sent in the URL and it'll return the data. It's up to you to write some code to add the parameters you want in the URL then call that URL with cURL and process the response.
 
Back
Top Bottom