CodeIgniter Forums
Data from API - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Data from API (/showthread.php?tid=66766)



Data from API - neodite - 11-30-2016

Hi guys,

This is possibly a very stupid question, but I have never worked with (or needed) to work with an external API to get data on any of my projects.

But after getting some API documents from UKMail (UK currier company) it could prove to be pretty nice and beats scraping the data.

Now, I have no idea where to start with this in CodeIgniter, I have the documentation that tells me what data I need to pass, but have no idea on how to pass that data, as far as I can tell I send some data to the API and get XML data back?

Is there an example anywhere for passing information to an API? I searched around but can only found things to do with REST, is this what I want?

Any help on getting me started would be fantastic.

Cheers,
Neodite


RE: Data from API - milan alphansotech - 11-30-2016

I suggest you, make a library for that and then call the curl for API, once you get the data then process that data if needed and return to the controller.


RE: Data from API - neodite - 11-30-2016

I'm sorry, but I don't think you understand my question.


RE: Data from API - ismaelirc - 12-01-2016

Hey, body!

I'm not sure if I understand what you want: You want send YOUR data to other API, sure?

Well, try to look at the Guzzle Library, import it in your CI project. With this library you can send data to others API's.

I hope that this works for you, let me know Wink


RE: Data from API - neodite - 12-01-2016

Hi, cheers for the response.

I'm trying to get data FROM a companies web service API.

They have given my the docs for what details to send, like the user account provided etc. but I dont know how to send the request to get data.


RE: Data from API - ismaelirc - 12-05-2016

(12-01-2016, 08:58 AM)neodite Wrote: Hi, cheers for the response.

I'm trying to get data FROM a companies web service API.

They have given my the docs for what details to send, like the user account provided etc. but I dont know how to send the request to get data.

OK, so... the Guzzle library works for that also.

http://guzzle3.readthedocs.io scroll down and see the examples.


RE: Data from API - neodite - 12-05-2016

Ah, that looks like it should do it. Thank you! Smile