http client
guzzle is a like post man
composer reqyuer guzzlehttp/guzzle
reqres.in-> to provide fake data-> practise data
examples of seeders
to communicate with aapi
$curl=curl_init();
curl_setopt
POST
GET
UPDATE/PUT
DELETE
LIKE CRUD
form enctype="multipart/from-data"]
{{ method_filed('PUT')}} -> ONE TYPE OF HELPER ABOUT METHOD
METHOD = PUT
http request with post
http::Post
use Illuminate\Support\Facades\Http; $response = Http::get('http://example.com');
The get
method returns an instance of Illuminate\Http\Client\Response
, which provides a variety of methods that may be used to inspect the response:
$response->body() : string;$response->json($key = null) : array|mixed;$response->object() : object;$response->collect($key = null) : Illuminate\Support\Collection;$response->status() : int;$response->ok() : bool;$response->successful() : bool;$response->redirect(): bool;$response->failed() : bool;$response->serverError() : bool;$response->clientError() : bool;$response->header($header) : string;$response->headers() : array;
https://reqres.in/
req
res
Which façade is used to making Http requests?
Marked Answer : Http
Correct Answer : Http
Which method is used to dump request instance before it is sent?
Marked Answer : dd()
Correct Answer : dd()
Which Http Client package is used as a dependency?
Marked Answer : Guzzle
Correct Answer : Guzzle
Which method is used to provide a raw request body when making a request?
Marked Answer : withBody()
Correct Answer : withBody()
Which method is used to add headers to the requests?
Marked Answer : withHeader()
Correct Answer : withHeaders()
No comments:
Post a Comment