Esempio n. 1
0
 public static function fetchServers(array $credentials)
 {
     $url = $credentials['url'] ?? 'https://robot-ws.your-server.de/server';
     $auth = base64_encode(sprintf('%s:%s', $credentials['user'], $credentials['pass']));
     $response = Http::request($url, '', [sprintf('Authorization: Basic %s', $auth)]);
     return static::makeServerList($credentials['name'], json_decode($response));
 }
 public static function fetchServers(array $credentials)
 {
     $url = $credentials['url'] ?? 'https://api.digitalocean.com/v2/droplets';
     $headers = ['Content-Type: application/json', sprintf('Authorization: Bearer %s', $credentials['token'])];
     $response = Http::request($url, '', $headers);
     return static::makeServerList($credentials['name'], json_decode($response));
 }