Quote:
Originally Posted by Tigairius
I am trying to do a "Live Stats" section on Ol' Wests new site.
under actionPlayeronline on the Control-NPC I wrote:
requesthttp("olwest.awardspace.com", 80, "index.php?do=stats&pcount=" @ allplayerscount);
and on the stats page I wrote:
<?PHP
if($_GET['pcount'] > 0){
$content = $_GET['pcount'];
$fp = fopen("./stats.txt","wb");
fwrite($fp,$content);
fclose($fp);
}
$display = fopen("./stats.txt","r");
$line = fgets($display);
echo"There are currently ". $line ." people online.";
?>
For some reason the request HTTP isn't working on my server, is it disabled? I spoke with Björn about how he did it on his Graal Kingdoms Lib site, and he said it doesn't work anymore but he's not sure why. Any input on this?
|
Try using requesturl:
PHP Code:
temp.link = "http://www.server.com/path/to/script.php?whatever=foo";
requesturl(temp.link);
Thats how I get live stats on my webserver.
Also, For the PHP file, Try this:
PHP Code:
<?php
if (isset($_GET['playersonline']))
{
$data = fopen("serverdata.txt", "w+") or die("");
fputs($data, $_GET['playersonline']);
}
?>