26 lines
538 B
PHP
26 lines
538 B
PHP
<?php
|
|
|
|
namespace App\Utilities;
|
|
|
|
use Exception;
|
|
use Illuminate\Http\Client\PendingRequest;
|
|
use Illuminate\Support\Facades\Http;
|
|
|
|
class Guzzle
|
|
{
|
|
public static function load($url, $debug = 0)
|
|
{
|
|
BetsapiCounter::count($debug);
|
|
|
|
if ($debug) {
|
|
Notice::note($url, 'g');
|
|
}
|
|
|
|
$data = Http::retry(3, 2, function (Exception $exception, PendingRequest $request) {
|
|
return $exception instanceof ConnectionException;
|
|
})->get($url);
|
|
|
|
return json_decode($data, true);
|
|
}
|
|
}
|