Request

For discussion of the Poker Mavens server module and other administration topics
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: Request

Post by Kent Briggs »

MonTheHoops wrote:Will the API allow access to the logfiles?
I don't currently have any commands to retrieve the error or event logs but if your scripting system is located on the same server as the game then you could just access them directly (being careful not to lock out the game server from writing to them).
For instance is it capable of listing previous results in tournaments or ring games?
Ring games don't really have any results to retrieve since they are continuous. TournamentResults is the API command for retrieving previous tournament results. See help file for details.
Can it show who has won the most tournaments?
You would have compile that yourself and store the results in a database.
Vitao
Posts: 9
Joined: Sun Nov 09, 2008 5:43 am

Re: Request

Post by Vitao »

If you would like to do it in ASP, you can use this as a sample code...

Code: Select all

 Dim xmlhttp,xmlResponse
 xmlResponse = ""
 set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
 xmlhttp.open "POST", "http://12.34.56.78:3077/api", false 'CHANGE THE IP AND PORT TO YOURS
 xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
 xmlhttp.send "Password=MYAPIPASSWORD&Command=ConnectionsList&Fields=Player" 'CHANGE THE PASSWORD TO YOURS
 If xmlhttp.Status = 200 Then
 	xmlResponse = xmlhttp.ResponseText
 End if
 set xmlhttp = Nothing
 if xmlResponse <> "" then
  Dim sptResponse,i,sptLine,tmpString,iCount
  Dim playerData()
  i = 0
  Dim playerCount
  playerCount = 0
  sptResponse = split(xmlResponse,vbcrlf)
  for i = LBound(sptResponse) to UBound(sptResponse)
   if Instr(sptResponse(i),"=") then
    sptLine = split(sptResponse(i),"=")
    if Left(lcase(sptLine(0)),6) = "player" AND sptLine(1) <> "" then
     tmpString = tmpString & sptLine(1) & ","
    elseif Left(lcase(sptLine(0)),6) = "connec" AND sptLine(1) <> "" then
     playerCount = sptLine(1)
    end if
   end if
  next
  response.write "Players Online: " & Left(tmpString,Len(tmpString)-1)
  response.write "Player Count: " &  Trim(playerCount)
 end if
MonTheHoops
Posts: 48
Joined: Sat Jun 21, 2008 3:39 pm

Re: Request

Post by MonTheHoops »

Kent Briggs wrote:
MonTheHoops wrote:Like how many people are currently connected
<?php
include "API.php";
$params = "Password=" . $pw . "&Command=ConnectionsList";
$api = Poker_API($url,$params);
if ($api["Result"] == "Error") die("Error: " . $api["Error"]);
echo "The number of connections is " . $api["Connections"];
?>
what tournaments are available
<?php
include "API.php";
$params = "Password=" . $pw . "&Command=TournamentsList&Fields=Name,BuyIn,Status";
$api = Poker_API($url,$params);
if ($api["Result"] == "Error") die("Error: " . $api["Error"]);
$n = $api["Tournaments"];
echo "<b>Tournaments Available</b><br>";
for($i=1;$i<=$n;$i++) echo $api["Name".$i] . " - " . $api["BuyIn".$i] . " - " . $api["Status".$i] . "<br>";
?>
who is currently winning the tournament?
<?php
include "API.php";
$tname = "Tournament #1";
$params = "Password=" . $pw . "&Command=TournamentsPlaying&Name=" . urlencode($tname);
$api = Poker_API($url,$params);
if ($api["Result"] == "Error") die("Error: " . $api["Error"]);
if (isset($api["Rank1"])) echo "Chip leader for " . $tname . " is " . $api["Player1"] . " (" . $api["Chips1"] . ")";
else echo $tname . " is not running";
?>
Hi Kent,

Could you update these 3 above for the new API commands please? None work for me now.

Cheers in advance.

Paul.
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: Request

Post by Kent Briggs »

MonTheHoops wrote: Could you update these 3 above for the new API commands please? None work for me now.
Change this line:

$api = Poker_API($url,$params);

to this:

$api = Poker_API($url,$params,true);

That third parameter tells the Poker_API() function to return the results in an associative array rather than in a ordinary array. That was previously the default setting but now it's an option in the updated version.
MonTheHoops
Posts: 48
Joined: Sat Jun 21, 2008 3:39 pm

Re: Request

Post by MonTheHoops »

Sorted...

Thank you sir.

:D
Post Reply