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
Problem in working with LogsHandHistory and Rake
-
- Site Admin
- Posts: 5880
- Joined: Wed Mar 19, 2008 8:47 pm
Re: Problem in working with LogsHandHistory and Rake
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 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
Re: Problem in working with LogsHandHistory and Rake
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?
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?
-
- Site Admin
- Posts: 5880
- Joined: Wed Mar 19, 2008 8:47 pm
Re: Problem in working with LogsHandHistory and Rake
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 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?
Re: Problem in working with LogsHandHistory and Rake
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.
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.
-
- Site Admin
- Posts: 5880
- Joined: Wed Mar 19, 2008 8:47 pm
Re: Problem in working with LogsHandHistory and Rake
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: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.
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";
Re: Problem in working with LogsHandHistory and Rake
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
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
-
- Site Admin
- Posts: 5880
- Joined: Wed Mar 19, 2008 8:47 pm
Re: Problem in working with LogsHandHistory and Rake
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 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 ?
Re: Problem in working with LogsHandHistory and Rake
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?
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?
-
- Site Admin
- Posts: 5880
- Joined: Wed Mar 19, 2008 8:47 pm
Re: Problem in working with LogsHandHistory and Rake
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.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 ":"