laravel http client

 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




HTTP::GET(URL);





BOTH ARE GETTING SAME REPOSNE BUT WHATS THE DIFFERENCE IS




HTTP REQUEST METHODS

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


  1. Which façade is used to making Http requests?

    Marked Answer : Http

    Correct Answer : Http

  2. Which method is used to dump request instance before it is sent?

    Marked Answer : dd()

    Correct Answer : dd()

  3. Which Http Client package is used as a dependency?

    Marked Answer : Guzzle

    Correct Answer : Guzzle

  4. Which method is used to provide a raw request body when making a request?

    Marked Answer : withBody()

    Correct Answer : withBody()

  5. Which method is used to add headers to the requests?

    Marked Answer : withHeader()

    Correct Answer : withHeaders()







No comments:

Post a Comment

Event listening in react

 How we can listen to som eevents some envents fire like click or automatically user enters into input button , that is event on word type i...