Location: PHPKode > projects > ezStats for XBOX Live > ezStats2_xbl/admin/apitest.php
<?php
	error_reporting (E_ALL|E_STRICT);
	
	require '../tmp/sql.php';
	require '../classes/mysql.php';
	require '../classes/settings.php';
	require '../classes/security.php';
	require '../classes/functions.php';
	require '../classes/session.php';
	require '../classes/login.php';
	require '../classes/template.php';
	require '../classes/player.php';
	require '../classes/stats.php';
	require '../classes/signatures.php';
	require '../classes/xbl.php';
	
	
	// Navigation
	echo '<a href="apitest.php?info">PHP-Info</a><br/>';
	echo '<a href="apitest.php?more">Settings</a><br/>';
	echo '<a href="apitest.php?curl">cURL Test</a><br/>';
	echo '<a href="apitest.php?xbl">XBL Test</a><br/>';
	echo '<br/><br/><br/>';
	
	
	// PHP-Info
	if (isset($_GET['info'])) {
		die(phpinfo());
	}
	
	
	// Settings
	if (isset($_GET['more'])) {
		$settings = new Settings();
		echo "<br/>Ident: ".$settings->get('ident');
		echo "<br/>Key: ".$settings->get('key');
		echo "<br/>Path: ".$settings->get('path');
		die();
	}
	
	
	// cURL-Test
	if (isset($_GET['curl'])) {
		$postdata = Array(
			'player' => 'ezzemm',
			'opt' => 'clear,global'
		);
		
		// BF3STATS-API
		$c=curl_init('http://api.bf3stats.com/pc/player/');
		curl_setopt($c,CURLOPT_HEADER,false); curl_setopt($c,CURLOPT_POST,true); curl_setopt($c,CURLOPT_USERAGENT,'BF3StatsAPI/0.1'); curl_setopt($c,CURLOPT_HTTPHEADER,array('Expect:')); curl_setopt($c,CURLOPT_RETURNTRANSFER,true); curl_setopt($c,CURLOPT_CONNECTTIMEOUT,5); curl_setopt($c,CURLOPT_POSTFIELDS,$postdata);
		
		$result = curl_exec($c);
		$status = curl_getinfo($c,CURLINFO_HTTP_CODE); $error = curl_error($c); $errno = curl_errno($c);
		curl_close($c);
		
		echo "<br><br>BF3STATS:<br>Status: $status<br>Error: $error ($errno)<br>Result: $result";
		
		
		// THIS PAGE
		$settings = new Settings();
		$c=curl_init($settings->get('path').'/admin/apitest.php');
		curl_setopt($c,CURLOPT_HEADER,false); curl_setopt($c,CURLOPT_POST,true); curl_setopt($c,CURLOPT_USERAGENT,'BF3StatsAPI/0.1'); curl_setopt($c,CURLOPT_HTTPHEADER,array('Expect:')); curl_setopt($c,CURLOPT_RETURNTRANSFER,true); curl_setopt($c,CURLOPT_CONNECTTIMEOUT,5); curl_setopt($c,CURLOPT_POSTFIELDS,$postdata);
		
		$result = curl_exec($c);
		$status = curl_getinfo($c,CURLINFO_HTTP_CODE); $error = curl_error($c); $errno = curl_errno($c);
		curl_close($c);
		
		echo "<br><br>THIS PAGE:<br>Status: $status<br>Error: $error ($errno)<br>Result: $result";
		
		
		// EZSTATS
		$c=curl_init('http://curl.ezstats.org/?version');
		curl_setopt($c,CURLOPT_HEADER,false); curl_setopt($c,CURLOPT_POST,true); curl_setopt($c,CURLOPT_USERAGENT,'BF3StatsAPI/0.1'); curl_setopt($c,CURLOPT_HTTPHEADER,array('Expect:')); curl_setopt($c,CURLOPT_RETURNTRANSFER,true); curl_setopt($c,CURLOPT_CONNECTTIMEOUT,5); curl_setopt($c,CURLOPT_POSTFIELDS,$postdata);
		
		$result = json_decode(curl_exec($c));
		$status = curl_getinfo($c,CURLINFO_HTTP_CODE); $error = curl_error($c); $errno = curl_errno($c);
		curl_close($c);
		
		echo "<br><br>EZSTATS:<br>Status: $status<br>Error: $error ($errno)<br>Result: $result";
		
		die();
	}
	
	
	// XBL Test
	if (isset($_GET['xbl'])) {
		echo "<pre>";
		$name = "ezzemm4u";
		
		$api = new XboxApi();
		
		
		$profile = $api->fetch_profile($name);
		$games   = $api->fetch_games($name);
		
		print_r($profile);
		print_r($games);
	}
?>














Return current item: ezStats for XBOX Live