Support the ongoing development of Laravel.io →
posted 2 years ago
Laravel
Last updated by @minamisawa 2 years ago.
0
Solution

My best guess is that you don't have a timeout set, so the request keeps trying forever.

Try this:

Http::timeout(5)->get("http://127.0.0.1:8000/testtest";);

In Laravel 9, HTTP requests have a timeout set by default. But in Laravel 8 you'll have to set one manually.

minamisawa liked this reply

1
Solution selected by @minamisawa

Thank you for wisdom. We could certainly get a timeout result.

However, we would like to determine the cause if possible. The code on the receiving end of the cURL just returns the simplest json and we are able to get it to work on the server. Is the server started by artisan unable to perform new process generation?

0

Have you tried using postman/insomnia prior to http:get(), just as a general attempt? Maybe the port is already occupied at the time you send the request?

minamisawa liked this reply

1

Thank you very much. We were able to figure out the cause of the problem.

  1. When we tried to access port 8000 again while processing on port 8000, it was occupied.
  2. When the port was occupied, the program did not stop because the ARTISAN side was waiting for the result forever.

And the solution was follows Start on port 8000 and port 8001, open one in a browser and use the other as a destination for cURL.

thank you both for your time.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.