oc-adrema-plugin/support/Proxy.php

24 lines
394 B
PHP
Raw Normal View History

2024-02-03 22:36:56 +01:00
<?php
namespace Silva\Adrema\Support;
use Silva\Adrema\Models\Settings;
use Http;
class Proxy
{
public function run(string $url): ?array
{
$url = str($url)->start('/');
$baseUrl = Settings::get('base_url');
$response = Http::get($baseUrl . $url);
if (!$response->ok()) {
return null;
}
return $response->json();
}
}