![]() |
requesthttp & PHP help
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? |
Quote:
PHP Code:
Also, For the PHP file, Try this: PHP Code:
|
requesturl worked very well, thanks :)
|
1 Attachment(s)
Just so you know, you should really put some sort of security or IP checking or something in your PHP script to confirm that the data is actually coming from the gserver.
You can probably find the IP of the server from the Graal Stats, and then check $_SERVER['REMOTE_ADDR'] against that IP or something, I guess. |
Eventually also remember the requesturl object, e.g. this.request = requesturl(...), otherwise the request might be cancelled/deleted before the connection is established
|
Quote:
|
Quote:
|
I don't know how it works unless it connects to graal as some sort of bot. I've no idea how it would do this though.
|
I think it's sent through the login server.
|
| All times are GMT +2. The time now is 01:51 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.