PDA

View Full Version : Random habbos.... lalala.



Protege
13-04-2008, 12:20 AM
http://www.driftpanzy.co.uk/habbo/index.php


Got bored, im tired so prob some mistakes or some critics want to be clever and prove something that ive done wrong to make them loook bigg but OH WELL!


<style>
.online {
border-bottom-style:dashed;
border-top-style:dashed;
border-left-style:dashed;
border-right-style:dashed;
border-top-width:thin;
border-bottom-width:thin;
border-left-width:thin;
border-right-width:thin;
border-bottom-color:#666666;
border-top-color:#666666;
border-left-color:#666666;
border-right-color:#666666;
font-family:Tahoma;
font-size:12px;
font-style:normal;
background: #EFEFEF;
}
.offline {
border-bottom-style:dashed;
border-top-style:dashed;
border-left-style:dashed;
border-right-style:dashed;
border-top-width:thin;
border-bottom-width:thin;
border-left-width:thin;
border-right-width:thin;
border-bottom-color:#333333;
border-top-color:#333333;
border-left-color:#333333;
border-right-color:#333333;
font-family:Tahoma;
font-size:12px;
font-style:normal;
}
</style>
<?php
// lalala. random habbos..
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.habbo.co.uk/habblet/xml/promo_habbos");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$file = curl_exec($ch);
$filename = "habbos.xml";
if (is_writable($filename)) {
if (!$handle = fopen($filename, 'w')) {
exit; }
if (fwrite($handle, $file) === FALSE) {
exit; }
fclose($handle);
curl_close($ch);
}
if(file_exists("habbos.xml")) {
$loadit = simplexml_load_file("habbos.xml");
$rows = 0;
$cols = 0;
echo('<table width="400" border="0"><tr>');
foreach ($loadit->children() as $fetch) {
$name = $fetch["name"];
$url = $fetch["url"];
$status = $fetch["status"];
$group = $fetch["groupBadge"];
$badge = $fetch["badge"];
$image = 'http://www.habbo.co.uk/habbo-imaging/avatarimage?user='.$name.'&action=&direction=3&head_direction=3&gesture=sml&size=l';
if($status == "1") {
$status = "habbo_online_anim.gif";
$class = "online";
} else {
$status = "habbo_offline.gif";
$class = "offline"; }
if($badge == "") { $ihc = "dot_clear.gif";
} else { $ihc = $badge; }
if($group == "") { $badge = "dot_clear.gif";
} else { $badge = "http://www.habbo.co.uk".$group; }
if($rows < 2) {
if($cols < 4) {
echo('<td><table width="150" class="'.$class.'" border="0"><tr><td><center><img src="'.$ihc.'"></center></td><td><center><img src="'.$image.'"></center></td><td><center><img src="'.$badge.'"></center></td></tr><tr><td colspan="3"><center>'.$name.'</center></td></tr><tr><td colspan="3"><center><img src="'.$status.'"></center></td></tr></table></td>');
$cols++;
} else {
if($rows < 1) {
echo('</tr><tr><td><table width="150" class="'.$class.'" border="0"><tr><td><center><img src="'.$ihc.'"></center></td><td><center><img src="'.$image.'"></center></td><td><center><img src="'.$badge.'"></center></td></tr><tr><td colspan="3"><center>'.$name.'</center></td></tr><tr><td colspan="3"><center><img src="'.$status.'"></center></td></tr></table></td>');
$rows++;
$cols = 1; } }
} else {
echo('</td></table>'); }
}
} else { exit("Failed to load."); }
?>
have habbos.xml created in the DIRECTORY and get the images that you need off of my live example...

http://www.driftpanzy.co.uk/habbo/index.php


WORD UP! im boooooooooooored what should i doooooooooooooooo

Jamieb
13-04-2008, 08:50 AM
Thats Pritty cool... +rep :)

Florx
13-04-2008, 08:57 AM
Good stuff but why did you "download" the data off the habbo server then use that new file to get the data?

It would be quicker just to get the data off the habbo server live?

Protege
13-04-2008, 09:02 AM
cuz it wasn't working and this was likely cause I was using WAMP on my PC when making it, if it works direct from Habbo, do it that way and it will be faster.

Blob
13-04-2008, 12:32 PM
No online habbo's come up for me

Protege
13-04-2008, 03:09 PM
Its pulling them out at random, theres more offline than online people. When someones online you will get a different background on the box and "online", I can probably code it to grab until it gets online, but that be a lot of bandwidth usage most likely.

I'm working on the flash version of it too which is fun. ;]

Dentafrice
13-04-2008, 03:13 PM
Why don't you just use file_get_contents?



<?php
$xml_file = file_get_contents( "http://www.habbo.co.uk/habblet/xml/promo_habbos" ); // Grabs XML file.

$simplexml = new SimpleXMLElement( $xml_file );

?>

Protege
13-04-2008, 03:28 PM
I use methods that suit me, I program in my own style not yours - do your method if you must amend my code.

Dentafrice
13-04-2008, 03:30 PM
I'm not downsizing your methods, I am just saying.. if you wanted an easier way to do it.. that would be an easier way.

No use to bring CURL in for something that small of a task.

Protege
13-04-2008, 03:32 PM
It seemed logical at the time, seeing as I was extremely tired I think it was an alright decision.

Dentafrice
13-04-2008, 03:34 PM
It seemed logical at the time, seeing as I was extremely tired I think it was an alright decision.
I can see where you are coming from, but CURL takes up more resources, and more loading time then it would if you used file_get_contents.

If you want, use microtime to calculate the diff. between them.

Protege
13-04-2008, 03:40 PM
I know what your saying, and yeah it should be faster. If people want to edit that, go ahead I'm not stopping no one.

Protege
13-04-2008, 11:00 PM
Lala done the flash. I cant be bothered with crossdomain.xml policies so have the source, check it out - basic outline.

http://www.driftpanzy.co.uk/habbo/habboTest.fla

have fun, i'm too tired play around with it

Protege
14-04-2008, 10:19 AM
The flash works, http://www.driftpanzy.co.uk/habbo/habboTest.html - But Im grabbing information using PHP from Habbo still - But it works and its at an okay speed.

Remotive
16-04-2008, 08:58 AM
The link doesn't work for me, have you deleted it?

Protege
16-04-2008, 03:13 PM
they should still work, but the FLA source isn't the same to the one I've done I don't think. I've had to use PHP to grab the data for FLASH as I couldn't figure the cross domain policies. Also you will need to edit it so It clears the badges/groupbadge after each load (I haven't done that as I just noticed.) pretty easy just make it load a image from the library like a invisible gif.

Remotive
16-04-2008, 03:54 PM
they should still work, but the FLA source isn't the same to the one I've done I don't think. I've had to use PHP to grab the data for FLASH as I couldn't figure the cross domain policies. Also you will need to edit it so It clears the badges/groupbadge after each load (I haven't done that as I just noticed.) pretty easy just make it load a image from the library like a invisible gif.
The flash one works, and looks great. You should put this up for download or something but have like people put copyright somewhere on their site for it. :)

EDIT: Just noticed the download, well done. ;)

Protege
16-04-2008, 05:25 PM
I doubt people use it in all honesty :P loools

shizzle
16-04-2008, 05:28 PM
Its ok make it more appealing, add a background and arange it in the middle :) or add more.

Protege
16-04-2008, 05:29 PM
you can add more, the flash is not aligned to center. The max I think you can have is 25 or 50, I forgot. Its there for you to mess with.

shizzle
16-04-2008, 05:37 PM
Cba lol just saying for improvements.

Protege
16-04-2008, 05:44 PM
I usually just release it for others can improve on it, after I released something I really don't go back to improve.

shizzle
16-04-2008, 06:16 PM
Oh I see, then they just improve it.

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