PDA

View Full Version : [PHP] Number of habbos online [PHP]



parky1306
07-04-2009, 03:53 PM
Ok so theres a new habbo layout, which means the codes changed right?

so can anyone tell me the current code for displaying the number of habbos online, and tell me where i can host it e.g. **********, etc etc

Ty in advance

Blinger1
07-04-2009, 09:48 PM
Its still the same code :S??



<?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
08-04-2009, 01:10 AM
Its still the same code :S??



<?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");
?>


I cant use this one as 11ombDotCom doesnt support it ;[

Blinger1
08-04-2009, 01:11 AM
change host then.. There are plenty of hosts which support PHP ;)

Turbocom
08-04-2009, 01:48 AM
<?php

if ($_GET['highlight'] === 'true')
{
highlight_file(__FILE__);
}

else
{
$html = file_get_contents('habbo.html');
$time = microtime(true);

preg_match('#<span class="stats-fig">(\d+)</span>#', $html, $matches);

echo microtime(true) - $time;
}

:)

Blinger1
08-04-2009, 03:12 AM
<?php

if ($_GET['highlight'] === 'true')
{
highlight_file(__FILE__);
}

else
{
$html = file_get_contents('habbo.html');
$time = microtime(true);

preg_match('#<span class="stats-fig">(\d+)</span>#', $html, $matches);

echo microtime(true) - $time;
}

:)
we have already solved it though? He just needs a decent host.

Dentafrice
08-04-2009, 03:28 AM
<?php

if ($_GET['highlight'] === 'true')
{
highlight_file(__FILE__);
}

else
{
$html = file_get_contents('habbo.html');
$time = microtime(true);

preg_match('#<span class="stats-fig">(\d+)</span>#', $html, $matches);

echo microtime(true) - $time;
} :)
That's an incorrect code. That has benchmarking code in it, and a file highlighter.. it doesn't display the users online at all.. nor does it even check the real Habbo, but a saved version of the homepage.

Iszak
08-04-2009, 08:47 PM
Yeah, that code was designed to eliminate the number of factors when benchmarking by using a static file versus the habbo server request which the response time could vary depending on the server load (sure you'll get read variations with a static file but it would be less).

Want to hide these adverts? Register an account for free!