Home > Back-end >  how to get http request detail in laravel?
how to get http request detail in laravel?

Time:10-10

I have an http client request like this?

        try {
           $request = json_encode($data);
           $result = $this->pendingRequest->{$method}('http://test.local/general/wallets/1000000', $data);
           // this is my request detail
           $request = $result->transferStats ? Message::toString($result->transferStats->getRequest()) : $request;
           $result->throw();
           $this->setLog($provider, $step, $request, $result->body(), $url, $result->status());
           return $result;
         } catch (RequestException $exception) {
          // I need to http request detail            
         } catch (ConnectionException $exception) {
          // I need to http request detail
         }

I need to get my request param and headers and token and every thing that send to third party in cache exceptions. I can get detail in try via: Message::toString($result->transferStats->getRequest())

CodePudding user response:

you can @dd($request); on blade OR dd($request); on controllers etc..

CodePudding user response:

Illuminate\Http\Client\Request

headers() : array

  • Get the request headers.

parameters() : array

  • Get the request's form parameters.

body() : string

  • Get the body of the request.

data() : array

  • Get the request's data (form parameters or JSON).

CodePudding user response:

You can take it as

$request->all();

if you want to see more regular. you can try

dd($request->all());
  • Related