Kieran
02-11-2012, 06:38 PM
Hello,
As some of you are probably aware Habbo recently changed their systems so that mottos couldn't be grabbed using the normal method from the homepages.
Below is a new PHP function I've written to successfully grab peoples mottos :)
<?php
function mottoGrab($username) {
$url = 'http://www.habbo.com/home/'.$username;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)');
curl_setopt($ch, CURLOPT_COOKIE, "YPF8827340282Jdskjhfiw_928937459182JAX666=".$_SERVER['SERVER_ADDR']); //saved cookies
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$string = curl_exec ($ch);
curl_close ($ch);
$regex = '#\<div class="profile-motto"\>(.+?)\<\/div\>#s';
preg_match($regex, $string, $matches);
$match = $matches[0];
echo $match;
}
mottoGrab(xxMattGxx);
?>
That should work just straight off. If not it will be to do with the Server IP address. If this is the case, simply replace the
curl_setopt($ch, CURLOPT_COOKIE, "YPF8827340282Jdskjhfiw_928937459182JAX666=".$_SERVER['SERVER_ADDR']); //saved cookies
line with:
curl_setopt($ch, CURLOPT_COOKIE, "YPF8827340282Jdskjhfiw_928937459182JAX666=YOURSERV ERIP"); //saved cookies
As some of you are probably aware Habbo recently changed their systems so that mottos couldn't be grabbed using the normal method from the homepages.
Below is a new PHP function I've written to successfully grab peoples mottos :)
<?php
function mottoGrab($username) {
$url = 'http://www.habbo.com/home/'.$username;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)');
curl_setopt($ch, CURLOPT_COOKIE, "YPF8827340282Jdskjhfiw_928937459182JAX666=".$_SERVER['SERVER_ADDR']); //saved cookies
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$string = curl_exec ($ch);
curl_close ($ch);
$regex = '#\<div class="profile-motto"\>(.+?)\<\/div\>#s';
preg_match($regex, $string, $matches);
$match = $matches[0];
echo $match;
}
mottoGrab(xxMattGxx);
?>
That should work just straight off. If not it will be to do with the Server IP address. If this is the case, simply replace the
curl_setopt($ch, CURLOPT_COOKIE, "YPF8827340282Jdskjhfiw_928937459182JAX666=".$_SERVER['SERVER_ADDR']); //saved cookies
line with:
curl_setopt($ch, CURLOPT_COOKIE, "YPF8827340282Jdskjhfiw_928937459182JAX666=YOURSERV ERIP"); //saved cookies