Download Horizon :: Staff Members :: TheTechGame.com :: XboxMB YouTube


Old 12-13-2011   #1 (permalink)
Cheater912's Avatar
:D
Join Date: Jul 2010
Location: New York
Posts: 5,683
Thanks: 12,224
Check XboxMB API Class

Here's an easy to use PHP wrapper class for the XboxMB API.

PHP Code:
class RequestMode
{
    const 
Username 'u';
    const 
UserID 'uid';
    const 
Minecraft 'mc';
}

class 
XboxMB
{
    private 
$userData;
    
    public function 
__get($userVar)
    {
        return 
$this->userData->$userVar;
    }
    
    public function 
loadUser($mode$data)
    {
        
$req curl_init();
        
curl_setopt($reqCURLOPT_URL"http://api.xboxmb.com/?$mode=" urlencode($data));
        
curl_setopt($reqCURLOPT_RETURNTRANSFERtrue);
        
$this->userData json_decode(curl_exec($req));
        
curl_close($req);
        return 
$this->userData $this->Valid false;
    }
    
    public static function 
GetUser($mode$data)
    {
        
$xmbUser = new XboxMB();
        return 
$xmbUser->loadUser($mode$data) ? $xmbUser false;
    }


XboxMB::GetUser will return FALSE if the user isn't found.
Otherwise, it will return the user object.


The Modes:
Username - Look-up a user by their username
UserID - Look-up a user by their unique user ID
Minecraft - Reverse look-up a user by their Minecraft username

Example Usage:
PHP Code:
$xmbUser XboxMB::GetUser(RequestMode::Username'Cheater912');
echo 
'Cheater912 has ' $xmbUser->Posts ' posts on XboxMB.com!'
__________________
Cheater912 is offline Send a message via Skype™ to Cheater912
Reply With Quote


Old 12-13-2011   #2 (permalink)
Regular Member
sgt frankieboy's Avatar
Join Date: Nov 2010
Location: Netherlands
Posts: 2,391
Thanks: 1,738
Default Re: XboxMB API Class

Looks nice, I'm almost done with my .NET DLL.
__________________


Minecraft World Editor - [BETA] YTMP
Programming Resources

Quote:
Originally Posted by Rich Cook
Programming today is a race between software engineers striving to build bigger and better
idiot-proof programs, and the Universe trying to produce bigger and better idiots.
So far, the Universe is winning.
sgt frankieboy is online now Send a message via ICQ to sgt frankieboy Send a message via AIM to sgt frankieboy Send a message via MSN to sgt frankieboy Send a message via Yahoo to sgt frankieboy Send a message via Skype™ to sgt frankieboy
Reply With Quote
The following user thanked this post: Supporter

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 09:19 AM.


 

Powered by vBulletin® Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
COPYRIGHT (c) 2010 - 2012 - XboxMB - DESIGN BY:
EDENWEBS.COM