Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

dan3460's avatar

How to see the actual HTTP client request

I'm working with an API, i cam make simple request but now i need to send a filter parameter formatted this way:

<Greenmile Server>/Route/filter?criteria={"filters":["id","organization.id"],"firstResult":0,"maxResults":10}

How i can see exactly the way the request is being made. Using Http::dd() only gives me the how the data is on my side but not how is being received by the site.

0 likes
4 replies
dan3460's avatar

I'm making a request like this:

    public function getTruckAssigned(int $routeId)
    {
        return
            Http::withHeaders($this->headers)
            ->post($this->baseSite . 'RouteEquipment/filter', [
                'route' => $routeId
            ])
            ->collect();
    }

I need to see what the actual request is being formatted. If i add a dd(), as indicated in the documentation i get this:

^ Illuminate\Http\Client\Request {#573 ▼
  #request: GuzzleHttp\Psr7\Request {#570 ▶}
  #data: array:1 [▶]
}
^ array:12 [▼
  "connect_timeout" => 10
  "http_errors" => false
  "timeout" => 30
  "laravel_data" => array:1 [▶]
  "on_stats" => Closure($transferStats) {#544 ▶}
  "synchronous" => true
  "handler" => GuzzleHttp\HandlerStack {#525 ▶}
  "cookies" => GuzzleHttp\Cookie\CookieJar {#486 ▶}
  "allow_redirects" => array:5 [▶]
  "decode_content" => true
  "verify" => true
  "idn_conversion" => false
]

Where i can see the data and how the request is being made but nor the actual form of the request to the website.

MohamedTammam's avatar

@dan3460 Use effectiveUri method.

$res = Http::get('http://example.com', ['name' => 'brabra', 'foo' => 'bar']);
$res->effectiveUri()->getHost(); // example.com
$res->effectiveUri()->getQuery(); // name=brabra&foo=bar
2 likes

Please or to participate in this conversation.