Show DevBest [PHP] Xbox Live Gamertag Checker

Status
Not open for further replies.

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
This literally took me 5 minutes to code.

All it does is checks if a Xbox Live Gamertag is available for you to use.
You simply enter a gamertag and press the button.

index.php
PHP:
<?php
if( $_POST['check'] )
{
	$gt = strip_tags( $_POST['gt'] );
	$exists = false;
	if( empty( $gt ) )
	{
		header( "Location: " . $_SERVER['PHP_SELF'] );
	}
	else
	{
		$check_url = "http://gamercard.xbox.com/en-GB/" . $gt . ".card";
		$check_url_source = file_get_contents( $check_url );
		$exists = ( eregi( "<div class=\"Stat\">--</div>", $check_url_source ) && eregi( "<div class=\"NoGame\"></div>", $check_url_source ) ) ? false : true;
		echo ( $exists == true ) ? "The gamertag <strong>" . $gt . "</strong> is already in use!" : "The gamertag <strong>" . $gt . "</strong> is not in use! You are free to use it.";
	}
}
else
{
	echo "Enter a Xbox Live Gamertag to see if it is already in use.<br>
	<form method=\"post\">
		<input type=\"text\" name=\"gt\" value=\"\" maxlength=\"1000\"> <input type=\"submit\" name=\"check\" value=\"&raquo;\">
	</form>";
}
?>

Demo:


Thanks,
- m0nsta.
 

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,195
3,906
Ooh, very nice, I have put you up a demo here:



- Nice release and thanks ;D.
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
Thanks for that Sledmore :)
and what do you mean xim?
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
No problem. And thanks :)

My site has been took down because I haven't paid the renewal price, but I've just renewed it so it should be back up soon so I will put a demo up.

I have got my site back now, so here is my real demo:
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
I think it messed up if you have symbols or spaces in your name or something.
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
All it does is grabs data from this URL:


That's Microsoft/Xbox's problem. Not mine.
 

Kushington

New Member
May 14, 2011
2
0
or use this
PHP:
<?php

$gamertag = 'l RaH l';

$url = "http://api.xboxleaders.com/user_api.php?gamertag=".urlencode($gamertag);

$output = file_get_contents($url);

$search = array('"OK"}}','{"user"');
$replace = array('"OK"}','"user"');

$output = str_replace($search,$replace,$output);

// try to convert the response into a PHP object
$obj = json_decode($output);

//print_r($obj);
if(!is_object($obj)) 
die("Error parsing JSON response\n");

//define variables
$avatar = ($obj->user->avatar);
$gold = ($obj->user->gold);

print $avatar;
print $gold;

//$array['error'] = array('code'=>200,'desc'=>'ok');
//$array['user']	= array('gold'=>0,'gamertag'=>0);
//$array['recent_games']  = array(array('recent_game'=>array('title'=>'one'),'recent_game'=>array('title'=>'two')));
//echo json_encode($array);
?>
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
Not Found

The requested URL /user_api.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.13 Server at api.xboxleaders.com Port 80
 

Sysode

Front-End Developer
Dec 11, 2012
1,673
848
Sorry, I know this post is over a year old; I have a problem with this.

I copy the code exactly and no-matter what gamertag I ente, it always seems to be in use. Not sure what's wrong..
 
Status
Not open for further replies.

Users who are viewing this thread

Top