Page 1 of 3

Player Info API

PostPosted: Thu Aug 15, 2013 11:24 pm
by KillerxKen
I was wondering if anyone knew: what would be the correct PHP to display players their basic info such as Username,total balance,chips in play(tourn and ring), and email. I would like to have it where this page is displayed right after one logs in, ala sealwithclubs. So I also need to figure out how to get the page to remember username with fetch command, so when the page loads it loads only the logged in players info ever. thanks for any advice

Ken

Re: Player Info API

PostPosted: Thu Aug 15, 2013 11:56 pm
by Kent Briggs
KillerxKen wrote:I was wondering if anyone knew: what would be the correct PHP to display players their basic info such as Username,total balance,chips in play(tourn and ring), and email.


AccountsGet is the API command for that, or at least everything except tournament chips (which have no relation to a player's chip balance).

Re: Player Info API

PostPosted: Fri Aug 16, 2013 12:01 am
by KillerxKen
I dont want it to display ALL the info/fields though, just those things listed, how would I do that?>

Re: Player Info API

PostPosted: Fri Aug 16, 2013 12:13 am
by Kent Briggs
KillerxKen wrote:I dont want it to display ALL the info/fields though, just those things listed, how would I do that?>


AccountsGet reports about 2 dozen fields but you would just grab the ones you care about and ignore the rest. For example, something like this (untested):

Code: Select all
include "API.php";
$player = "player_name_here";
$params = "Command=AccountsGet&Password=$pw&Player=$player";
$api = Poker_API($url, $params, true);
if ($api["Result"] != "Ok") die($api["Error"]);
echo "Chip balance for $player is " . $api["Balance"] . "<br>";
echo "Email for $player is " . $api["Email"] . "<br>";

Re: Player Info API

PostPosted: Fri Aug 16, 2013 12:17 am
by KillerxKen
thats what i was missing, thanks so much Mr. Briggs, and continued best of luck with this great product.

Re: Player Info API

PostPosted: Fri Aug 16, 2013 12:31 am
by KillerxKen
how would I get it to remember the players name?

Re: Player Info API

PostPosted: Fri Aug 16, 2013 9:15 am
by Kent Briggs
KillerxKen wrote:how would I get it to remember the players name?


Depends on what "it" is. In what context is your code being used? If the player is logging into your web site, they would be entering their own name into a form input. Or it's fetched from a cookie that you set. If you are running stats for every player you can fetch the whole list the AccountsList command in the API. Otherwise you could be saving and retrieving names from your own database.

Re: Player Info API

PostPosted: Fri Aug 16, 2013 11:47 pm
by KillerxKen
meaning when i have them login(to my webpage, not the software)and they are then sent to a page we will call "playerinfo.php" . I want the AP to remember atleast their username if not also the password, so the page displays the information we want.

Re: Player Info API

PostPosted: Sat Aug 17, 2013 9:08 am
by Kent Briggs
KillerxKen wrote:meaning when i have them login(to my webpage, not the software)and they are then sent to a page we will call "playerinfo.php" . I want the AP to remember atleast their username if not also the password, so the page displays the information we want.


That's typically done with a cookie on your login page. Then you would pass that to your php script via POST parameter.

Re: Player Info API

PostPosted: Sun Aug 18, 2013 3:46 am
by KillerxKen
I cant just have them submit their name and password to a login/form and just have it send back that info?