Creating Tables by API
-
- Posts: 107
- Joined: Wed May 06, 2009 12:59 pm
- Contact:
Creating Tables by API
Hi kent,
I wrote a PHP form to allow my players to create their own Ring Games. Zipped and Attached
Trouble is, they are created in Off-Line state. How do I get them to go online automatically?
I wrote a PHP form to allow my players to create their own Ring Games. Zipped and Attached
Trouble is, they are created in Off-Line state. How do I get them to go online automatically?
- Attachments
-
- CreateRingGame.zip
- (1.4 KiB) Downloaded 511 times
-
- Site Admin
- Posts: 5880
- Joined: Wed Mar 19, 2008 8:47 pm
Re: Creating Tables by API
Call the RingGamesOnline command after creating it with a "Name" parameter set to the table name.CanadaWest wrote: I wrote a PHP form to allow my players to create their own Ring Games. Zipped and Attached
Trouble is, they are created in Off-Line state. How do I get them to go online automatically?
-
- Posts: 107
- Joined: Wed May 06, 2009 12:59 pm
- Contact:
Re: Creating Tables by API
So that the player doesnt have to remember EXACTLY what he named the new table..
Is there a way to pass the new Name parameter to a RingGamesOnline command automatically?
Maybe via GET? (probably not because would have to url encode it)
Can I put a second command or form in the echo returned on successful creation of the table?
I'm probably missing something simple. i have a headache.
Is there a way to pass the new Name parameter to a RingGamesOnline command automatically?
Maybe via GET? (probably not because would have to url encode it)
Can I put a second command or form in the echo returned on successful creation of the table?
I'm probably missing something simple. i have a headache.
-
- Site Admin
- Posts: 5880
- Joined: Wed Mar 19, 2008 8:47 pm
Re: Creating Tables by API
Your script should be calling one command right after the other. You already got the name in your code when you did this:CanadaWest wrote:So that the player doesnt have to remember EXACTLY what he named the new table..
$Name = $_REQUEST["Name"];
So right after the first Poker_API() comes back, build a new param list and call it again:
$params = "Password=$pw&Command=RingGamesOnline&Name=" . urlencode($Name) ;
$api = Poker_API($url,$params,true);
-
- Site Admin
- Posts: 5880
- Joined: Wed Mar 19, 2008 8:47 pm
Re: Creating Tables by API
To group multiple commands together on the result of an if statement in PHP, you just surround them in curly braces:CanadaWest wrote:Can I put a second command or form in the echo returned on successful creation of the table?
Code: Select all
if ($myvar == "myvalue")
{
DoThis1;
DoThis2;
DoThis3;
}
else
{
DoThat1;
DoThat2;
DoThat3;
}
-
- Posts: 107
- Joined: Wed May 06, 2009 12:59 pm
- Contact:
Re: Creating Tables by API
I didn't know you could put two commands in the same script! A whole new world of possibilities!Kent Briggs wrote:
So right after the first Poker_API() comes back, build a new param list and call it again:
$params = "Password=$pw&Command=RingGamesOnline&Name=" . urlencode($Name) ;
$api = Poker_API($url,$params,true);
LOL
Thanks
-
- Site Admin
- Posts: 5880
- Joined: Wed Mar 19, 2008 8:47 pm
Re: Creating Tables by API
Oh yeah, look at some of my PHP examples at http://www.briggsoft.com/docs/pmavens/API_Examples.htm. The Player Search function makes 7 API calls there.CanadaWest wrote:I didn't know you could put two commands in the same script! A whole new world of possibilities!
-
- Posts: 48
- Joined: Sat Jun 21, 2008 3:39 pm
Re: Creating Tables by API
Just tried this one but I get an error when I try to create a table, it says Invalid Game Type specified, click back to try again.
Cheers
Cheers
-
- Site Admin
- Posts: 5880
- Joined: Wed Mar 19, 2008 8:47 pm
Re: Creating Tables by API
The form is escaping the apostrophe in Hold'em with a slash so change this line:MonTheHoops wrote:Just tried this one but I get an error when I try to create a table, it says Invalid Game Type specified, click back to try again.
"&Game=" . urlencode($Game) .
to this:
"&Game=" . urlencode(stripslashes($Game)) .
-
- Posts: 48
- Joined: Sat Jun 21, 2008 3:39 pm
Re: Creating Tables by API
Cheers Kent, got that to work now. Just waiting for the code to put the created games online as I'm completely clueless on the coding side of things, I just cant get my head around it at all..I've tried