Problem in working with LogsHandHistory and Rake

For general discussion of the Poker Mavens software
Post Reply
aminwxy
Posts: 17
Joined: Wed Apr 22, 2015 12:35 pm

Problem in working with LogsHandHistory and Rake

Post by aminwxy »

hi
we are coding a PHP to use API and retrieve Rake from LogsHandHistory
so the result is fine and we get it,
but i need some specific Data , such as The name of the winner of one pot and the rake Number of that pot.

how can i retrive theme with and extracting the numbers ?
i want to put theme in our database and do some work with it
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: Problem in working with LogsHandHistory and Rake

Post by Kent Briggs »

aminwxy wrote:how can i retrive theme with and extracting the numbers ?
i want to put theme in our database and do some work with it
You have to parse the data line by line looking for the key words that match the data you want to extract. For example, lines starting with "Hand #" indicate the beginning of the hand, lines starting with "** Deck **" indicate the end of the hand. Look for "xxxxxx wins " or "xxxxxx splits " to see hand winner. Lines starting with "Rake (" contain the rake info, etc. Hands with side pots may have multiple rakes and winners.
aminwxy
Posts: 17
Joined: Wed Apr 22, 2015 12:35 pm

Re: Problem in working with LogsHandHistory and Rake

Post by aminwxy »

so if i use "Substr" PHP Function ,as it is in the Api Example used, i cant extract the exact data,
for example :
$hand_winner = Substr($api[25],0,1) ;
output is not what we want !
and also if the username is 5 charactre or 9 character , "xxxxxx wins " or "xxxxxx splits " is miss match data
is there any alternative Function?
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: Problem in working with LogsHandHistory and Rake

Post by Kent Briggs »

aminwxy wrote:and also if the username is 5 charactre or 9 character , "xxxxxx wins " or "xxxxxx splits " is miss match data
is there any alternative Function?
This is basic string manipulation. Use a function like strpos() to find the position of " wins " in the line. Then use Substr() to pull out the name starting from the first position and ending in the position just before " wins ".
aminwxy
Posts: 17
Joined: Wed Apr 22, 2015 12:35 pm

Re: Problem in working with LogsHandHistory and Rake

Post by aminwxy »

ok thanks , i got that and Find The way,
only one problem remain,

if i want to find the exact line number of "Rake" and "win" ,
can i also using this method ?
because Line number in the result is different , for example $api[25] return different data in the result of all Hand.
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: Problem in working with LogsHandHistory and Rake

Post by Kent Briggs »

aminwxy wrote:if i want to find the exact line number of "Rake" and "win" ,
can i also using this method ?
because Line number in the result is different , for example $api[25] return different data in the result of all Hand.
All the data is returned in an array when you use the JSON option in the API call. Then you just loop through the array, examining each line as you go. The HandHistory example of the API Examples page shows how that is done:

http://www.briggsoft.com/docs/pmavens/A ... nd_history

Code: Select all

echo "<pre>\n";
for ($i = 0; $i < count($api -> Data); $i++) echo $api -> Data[$i] . "\n";
echo "</pre>\n"; 
aminwxy
Posts: 17
Joined: Wed Apr 22, 2015 12:35 pm

Re: Problem in working with LogsHandHistory and Rake

Post by aminwxy »

Hello again, and Thanks for your help and Reply,
I have one more question

Please look at this line :

"Rake (9000) Pot (450000) Players (UYT789: 225000, MASTER: 225000)"

How can i get this information from this line :
Rake , number of player and name of players ?

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

Re: Problem in working with LogsHandHistory and Rake

Post by Kent Briggs »

aminwxy wrote: "Rake (9000) Pot (450000) Players (UYT789: 225000, MASTER: 225000)"

How can i get this information from this line :
Rake , number of player and name of players ?
Just take the string apart systematically using the various PHP string functions available. Locate the first "(" and first ")". Pull the rake out in between those. Locate the second "(" and second ")". Pull the pot number out between those. Same with the player names. Look for the parentheses, colons, and commas and pull out the names and corresponding amounts until you reach the closing ")".
aminwxy
Posts: 17
Joined: Wed Apr 22, 2015 12:35 pm

Re: Problem in working with LogsHandHistory and Rake

Post by aminwxy »

i can get the rake number easily with a PHp functiona to find string between two character
but about the Player name , when it is 3 or more Player like this :

Rake (11548) Pot (577404) Players (UYT789: 140412, MR-77: 218496, Lady65: 19526, MASTER: 218496)

so i dont Understand how to get them, i can only retrive player one and two with find string between "(" and ":" also string between "," nad ":"

so Player 3 and 4 MASTER , Lady65 is not retrieve :((

any solution?
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: Problem in working with LogsHandHistory and Rake

Post by Kent Briggs »

aminwxy wrote: Rake (11548) Pot (577404) Players (UYT789: 140412, MR-77: 218496, Lady65: 19526, MASTER: 218496)
so i dont Understand how to get them, i can only retrive player one and two with find string between "(" and ":" also string between "," nad ":"
Find the start of the first player name. Then run a loop that pulls out the name and amount. If the character after amount is a comma, you repeat the loop and grab another name and amount. If it's a ")", end the loop and stop.
Post Reply