Update stats.php

Missed fetch code in last update..
This commit is contained in:
deepend-tildeclub 2024-05-13 13:47:24 -06:00 committed by GitHub
parent 3808666305
commit e5725c850f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 1 deletions

View File

@ -13,7 +13,19 @@ Author: ChatGPT
Author URI: https://chat.openai.com
License: LGPLv2.1
*/
function fetch_stats() {
$url = "https://stats.newnet.net/stats.json";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$response = curl_exec($ch);
if (curl_errno($ch)) {
curl_close($ch);
return null; // or handle the error as needed
}
curl_close($ch);
return json_decode($response);
}
function stats_shortcode() {
$stats = fetch_stats();
if (!$stats) {