Xbox Live API Class

Status
Not open for further replies.

Vick

Banned
Banned
297
2011
72
0
Xbox Live API Class
(Written in PHP)

Code:
<?php
/*
Title : Xbox Live API
Purpose : Xbox Live API Class
Version : 1.0
Date : 4/11/2013
Developer : Vick Kumar
Website : http://www.vickkumar.com.au/
Contact : vickkumar2011@gmail.com
*/

class xbox_live_api
{
function init($gamertag)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.xboxleaders.com/api/profile.json?gamertag=$gamertag");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$output = curl_exec($ch);
curl_close($ch);
$result = json_decode($output, true);
$this->result = $result;
}

public function Tier()
{
$this->tier = $this->result['Data']['Tier'];
return $this->tier;
}

public function IsValid()
{
$this->IsValid = $this->result['Data']['IsValid'];
return $this->IsValid;
}

public function IsCheater()
{
$this->IsCheater = $this->result['Data']['IsCheater'];
return $this->IsCheater;
}

public function OnlineStatus()
{
$this->OnlineStatus = $this->result['Data']['OnlineStatus'];
return $this->OnlineStatus;
}

public function GamerScore()
{
$this->GamerScore = $this->result['Data']['GamerScore'];
return $this->GamerScore;
}

public function Reputation()
{
$this->Reputation = $this->result['Data']['Reputation'];
return $this->Reputation;
}

public function Name()
{
$this->Name = $this->result['Data']['Name'];
return $this->Name;
}

public function Motto()
{
$this->Motto = $this->result['Data']['Motto'];
return $this->Motto;
}

public function Location()
{
$this->Location = $this->result['Data']['Location'];
return $this->Location;
}

public function Bio()
{
$this-Bio = $this->result['Data']['Bio'];
return $this->Bio;
}
}

$example = new xbox_live_api;
$example->init("griff oh");
echo $example->Tier(); // Outputs 'Gold'
echo $example->IsValid(); // Valid user = 1
echo $example->IsCheater(); // If cheater = 1, if not = 0
echo $example->OnlineStatus(); // is online = 1, if not = 0
 
Last edited by a moderator:
Status
Not open for further replies.
Back
Top