HTTP Client Timeout Laravel

Updated at 22-Aug-2022, By samar

HTTP Client Timeout Laravel

With this article, we’ll look at some examples of how to address the "HTTP Client Timeout Laravel" problem.

The default timeout for HTTP Client is rather long; however, Laravel HTTP allows you to define it yourself (in seconds) with the convenient timeout() method. You can use `Http::timeout(5)` method to define the timeout of HTTP Client request.
  • $response = Http::timeout(5)
        ->get('https://archive.org/metadata/TheAdventuresOfTomSawyer_201303');
    

    Connection timed out after 5005 milliseconds.

    use Http Facade

    use Illuminate\Support\Facades\Http;
    

Back to code snippet queries related laravel