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

awsim's avatar
Level 1

Laravel controller action called again after making an API request

I have a strange issue. I have controller action for example 'A' which is called on a POST request, in that controller action A I am initiating POST request to an API using guzzle.

Once the API call is initiated my same controller action 'A' is called again magically. I did replace guzzle with basic php curl but still I am facing the same issue.

The API is located on the same server but running on a different PORT (I dont think so which could be an issue as it is a completely separate application outside Laravels scope).

$client = new Client([ 'verify' => false ]); $request = $client->post('https://' . $hostname . ':8083/api/', ['auth' => ['admin', 'pass'], 'form_params'=>$postvars]);

$answer = $request->getBody();

// My same Controller action is called again after this code.

I have no clue what could be the issue. Any Help would be appreciated.

0 likes
0 replies

Please or to participate in this conversation.