• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Data from API

#1
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
Reply

#2
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.
Reply

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

#4
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
Reply

#5
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.
Reply

#6
(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.
Reply

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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.