larvel make http request

Solutions on MaxInterview for larvel make http request by the best coders in the world

showing results for - "larvel make http request"
Alessio
22 Jul 2019
1// To make requests, you may use the get, post, put, patch, and delete methods
2// provided by the Http facade.
3
4use Illuminate\Support\Facades\Http;
5
6$response = Http::get('http://example.com');
7
8// The get method returns an instance of Illuminate\Http\Client\Response,
9// which provides a variety of methods that may be used to inspect the response:
10$response->body() : string;
11$response->json() : array|mixed;
12$response->collect() : Illuminate\Support\Collection;
13$response->status() : int;
14$response->ok() : bool;
15$response->successful() : bool;
16$response->failed() : bool;
17$response->serverError() : bool;
18$response->clientError() : bool;
19$response->header($header) : string;
20$response->headers() : array;