Skip to content

Commit

Permalink
Update stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
Flolon committed Feb 11, 2022
1 parent f37eada commit 8d92bdf
Show file tree
Hide file tree
Showing 4 changed files with 350 additions and 329 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
app-env
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# server-info

Page to display info about my server

API is avalible at https://srv-info-api.flolon.cc/info.php
Page to display info about my VPS server from Vultr's API
25 changes: 25 additions & 0 deletions api/info.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

include("../../api-key.inc.php");

header("Access-Control-Allow-Origin: *");

$url = "https://api.vultr.com/v2/instances";

$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

$headers = array(
"Authorization: Bearer ".$apiKey,
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);

$resp = curl_exec($curl);
curl_close($curl);

$serverInfo = json_decode($resp)->instances;

echo json_encode($serverInfo[0]);

?>
Loading

0 comments on commit 8d92bdf

Please sign in to comment.