Does anyone have any experience in Laravel PHP?
3 21 Jul 2015 17:14 by u/Farrarzard
Hello, I am new to Laravel and web programming in general. I've reached a point in my current project where I need to make a RESTful API call, but I can't seem to find a well-documented way to do it. Does anyone have any suggestions on tools/methods? I've already been to stackoverflow and I can't find much useful information. I know there must be a way to do it, but I can't seem to figure it out.
Thanks in advance.
6 comments
0 u/a_of_s_t 21 Jul 2015 21:20
Are you making a RESTful API call on the server, or on the client? If it's the server, most of the time, you can just use cURL. See this Stackoverflow answer as well.
0 u/Farrarzard [OP] 22 Jul 2015 02:57
I intend to make the call on the client side. I have read a bit about GuzzleHttp, which seems like the best way to do it, but it just seems like there should be a way to do it with Laravel only.
0 u/Monqui 22 Jul 2015 20:57
REST API calls are basically just HTTP requests- Guzzle is (I think?) a more PHP friendly OO style way of doing HTTP requests, which is what cURL would do for you as well.
Inside of Laravel, you should be able to just roll a basic cURL request to your API.
0 u/Farrarzard [OP] 22 Jul 2015 22:47
That's what I ended up doing, I just needed some help figuring out where to put the code and how to access it. My buddy helped with that. Thanks!
0 u/topical_username 22 Jul 2015 21:14
What are you scripting in? Python has an awesome package called Requests that makes REST calls a breeze. My comment history is beginning to look like I wrote the package or something...I LOVE Requests, I can't help it. It's so easy.
0 u/Farrarzard [OP] 22 Jul 2015 22:48
I'm using Laravel PHP, which is php-based.