View Full Version : [PHP] Displying the amount of Habbos online
Halting
20-05-2006, 05:19 PM
Aye,
Welcome to a short tutorial which will teach you how to display the amount of Habbos Online the hotel.
Firstly, you need to create a .php document.
Inside your .php file, insert/add this code:
<?php
$page = file_get_contents("http://www.habbo.co.uk"); // Change the URL to the hotel you would like
$start = explode('<span class="stats-fig">', $page, 2);
$end = explode('</span>', $start[1], 2);
$amount = trim($end[0]);
echo "There are $amount Habbos online!"; // Set the message you want to be displayed (Leave in the $amount)
?> If there was 10001 Habbos Online http://habbohotel.co.uk (http://habbohotel.co.uk/) then the output of this code would be as follows:
There are currently 10001 Habbos on the UK Hotel!
The code is very easy to alter.
If there are any problems, let me know! PM me or send them as a reply. :)
Edited by --ss-- (Forum Super Moderator): The code has been updated to work with the current version ;).
This has been posted befor, try searching next time.Good tut though :)
Fonejacker
22-11-2006, 12:04 AM
http://phil1569.londonki.speed-networks.org/Habbosonline.php
What did i do wrong?
Try this code HA33OX
<?php
$page = file_get_contents("http://www.habbo.co.uk");
$start = explode('<td id="topbar-count">', $page, 2);
$end = explode(' Habbos online</td>', $start[1], 2);
$amount = trim($end[0]);
echo "There are $amount Habbos online!";
?>
Anyone got the updated version of this since habbo Home?
could u do something like instead of habbo yoursite.com?
:Liam
19-04-2007, 04:28 PM
could u do something like instead of habbo yoursite.com?
Just what I was thinking :P
Mashi
20-04-2007, 09:37 PM
Lol'd at senior thing!
Also Quite good PHP
Closel
21-04-2007, 02:14 PM
Mmmm
I could have got that
but thanks.
Blinger1
23-06-2007, 10:20 AM
if you need the new code it is
<?php
$page = file_get_contents("http://www.habbo.co.uk");
$start = explode('<td id="topbar-count">', $page, 2);
$end = explode(' members online</td>', $start[1], 2);
$amount = trim($end[0]);
echo "There are $amount Habbos online!";
?> edit: i used-1. 's code and changed it to show the new one;)
Displaying how many users are on your site is quite simple. I cannot be bothered posting seeing as I'm kind of eating, yet I advise you to view: http://www.roscripts.com/How_many_visitors_online_PHP_script-108.html
--ss--
08-04-2008, 07:35 PM
Displaying how many users are on your site is quite simple. I cannot be bothered posting seeing as I'm kind of eating, yet I advise you to view: http://www.roscripts.com/How_many_visitors_online_PHP_script-108.html
That's the code you'd use if you were to want a online users counter on your own site. Seeing as we can't write PHP onto the Habbo servers ourselves we just use the code in the original post to take the amount off the actual homepage. Both are completely different scripts ;).
Ailo Gaup
08-04-2008, 07:38 PM
thanks guys.
parky1306
16-03-2009, 06:06 PM
Anyone got the current code for this?
Ty in advance
Blinger1
17-03-2009, 04:44 AM
As i sent to you in PM:
<?php
$hotel = file_get_contents("http://www.habbo.co.uk/");
$start = explode('<span class="stats-fig">', $hotel, 2);
$end = explode('</span>', $start[1], 2);
$habbo = trim($end[0]);
echo("Habbos online: $habbo");
?>
parky1306
05-04-2009, 02:21 PM
would it work if i host this scrpt on **********?
Or if not, anyone know where i can host it for free?
-leestrong-
11-05-2009, 03:49 PM
This is just what I needed,
thanks!
- Lee
Chippiewill
20-10-2012, 03:15 PM
Is a bit more efficient, unfortunately habbo.com isn't a fan of file_get_contents any more.
<?php
$page = file_get_contents("http://www.habbo.fr"); // Change the URL to the hotel you would like
$pattern = '/<span class=\"stats-fig\">(.*?)<\/span>/s';
preg_match( $pattern , $page , $out );
echo "There are $out[1] Habbos online!"; // Set the message you want to be displayed (Leave in the $amount)
?>
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2026 vBulletin Solutions Inc. All rights reserved.