Re: Habbo-images updated. (bypass anti ddos from habbo)
Quote:
Originally Posted by
Boraida
Smart of you to use
curl. I didn't like the code so I'd a quick modify.
PHP Code:
<?php
define('DS', DIRECTORY_SEPARATOR);
// default settings
$look = array (
'figure' => 'hr-145-31.hd-180-1.ch-210-62.lg-285-64.sh-290-62',
'size' => 'b',
'direction' => '2',
'head_direction' => '2',
'gesture' => ''
);
// default map : ./avatars
if (!is_dir($map = './avatars')) {
if (!mkdir($map, 0, true)) {
exit('Can\'t make the folder chmod this folder');
}
}
foreach ($look as $k => $v) {
if (!empty($part = filter_input(INPUT_GET, $k))) {
$look[$k] = $part;
}
}
$image_path = $map . DS . md5(implode($look)) . '.png';
if (!file_exists($image_path)) {
$fp = fopen($image_path, 'w+');
$ch = curl_init('https://www.habbo.nl/habbo-imaging/avatarimage?' . http_build_query($look));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 1000);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0');
curl_exec($ch);
curl_close($ch);
fclose($fp);
}
$im = imagecreatefrompng($image_path);
header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);
Looks pretty but returns figures with white backgrounds.
http://i.imgur.com/0VWtkZD.png
Re: Habbo-images updated. (bypass anti ddos from habbo)
Quote:
Originally Posted by
Exonize
Oh lol add
PHP Code:
imagesavealpha($im, true);
below $im = ...
Quote:
Originally Posted by
Droppy
Well, instead of using server resources, why not just redirect to habbo page? If you can't, because most of your files are going through some local file, then in this local file instead of file_get_contents and redirects...
It's just an alternative for those whom doesn't want to use server resources... I don't know if it's the best approach though.
PHP Code:
<?php
function arrayToString($get)
{
$fields = "";
foreach($get as $key=>$value) {
$fields .= $key.'='.$value.'&';
}
return rtrim($fields, '&') . "&";
}
header("Location: http://www.habbo.com.br/habbo-imaging/avatarimage?" . arrayToString($_GET));
?>
It works? Yes, it does. Now, feel free to flame me all you want for this 1337 h4x approach.
Why creating a function like that if there's already a function called: http-build-query