This repository has been archived on 2022-03-01. You can view files and clone it, but cannot push or open issues or pull requests.
FS22_Webstats/runtime.php

97 lines
1.8 KiB
PHP

<?php
$url = "https://crimsonskygaming.net";
$sites = [
$url,$url.'/WebGL',$url.'/GZ-Runtime',$url.'/GZ-Smaller',$url.'/BR-Runtime',$url.'/BR-Smaller',$url.'/None-Runtime',$url.'/None-Smaller'
];
$i = 0;
foreach($sites as $site):
$url = $site . PHP_EOL;
echo '<h1>'.$url.'</h1><hr>';
$t = microtime( TRUE );
ob_start();
file_get_contents( $url );
ob_end_clean();
$t = microtime( TRUE ) - $t;
$t = number_format($t,2);
print "$url took $t seconds! <br>";
echo '<br>';
$ch = curl_init($url);
$info = curl_getinfo($ch);
curl_close($ch);
echo $url .' Took ' . $info['total_time'] . ' seconds to send a request';
?>
<br>
<?php
echo $url . '<br>';
echo '<pre>';
print_r(get_headers($url));
echo '</pre>';
echo '<pre>';
print_r(get_headers($url, true));
echo '</pre>';
endforeach;
?>
<?php
/* function get_contents($url) {
$http_response_header = file_get_contents($url);
return var_dump($http_response_header);
}
echo '<pre>';
get_contents($url);
echo '</pre>'; */
//var_dump($http_response_header);
?>
<?php
function get_time() {
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
return $time;
}
$start = get_time();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Page Load time">
<title>Technopoints | Page load time</title>
<h1>Technopoints | Page Load Time in PHP</h1>
<p>This is sample paragraph</p>
<?php
for($i=0;$i<100000;$i++) {
//a sample dummy loop
}
?>
<?php
$finish = get_time();
$total_time = round(($finish - $start), 4);
echo 'Page generated in '.$total_time.' seconds.';
?>