1
votes

Here is my code

$client = new Client(); // GuzzleHttp\Client

$result = $client->post('http://localhost:8000/api/login', [
    'form_params' => [
        'email' => '100@hello.com',
        'password'=>'secret',
        'device_token'=>'SAM-12-890'
    ]
]);

echo $result->getStatusCode();

But in response I got nothing after few seconds and My laravel instance's port acquired by another process in ubuntu machine.

So how to initiate internal post request by guzzle in laravel? is my url malformed?

1
Try using: http://Marcin
I did it was just a typo :/ @MarcinFightForJustice
are you using two projects. i.e calling one project from another or you are making a request to the same project's url?Oluwatobi Samuel Omisakin
same project's url, is this the port creating such problem?FightForJustice
what do you have on your /api/login url? Can you post the function that gets hitted by the route.PaladiN

1 Answers

1
votes

I have a guess that you are running your app locally using PHP integrated web server (php -S ...). Then, if you do an internal HTTP query inside an HTTP query from the browser, you get timeout because of a deadlock. That's because PHP integrated web server can handle only request at once (means that your internal request is queued and can be executed only the main request, but the main request is waiting for the internal request to complete).

If I'm correct, just try to run your app on PHP-FPM locally.