Callback Feature

For general discussion of the Poker Mavens software
Post Reply
MonTheHoops
Posts: 48
Joined: Sat Jun 21, 2008 3:39 pm

Callback Feature

Post by MonTheHoops »

Hi Kent,

Long time no speak.

Is there any examples available for the callback feature? PHP scripts that use this feature would be great, at least a place to start anyway..

Maybe one that shows an example of each callback available, then we could build on that and see what we come up with?

Cheers

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

Re: Callback Feature

Post by Kent Briggs »

MonTheHoops wrote:Is there any examples available for the callback feature? PHP scripts that use this feature would be great, at least a place to start anyway..
Here's the test PHP script (Callback.php) that I used for my own tests. It just creates/opens a local log file and appends the events to it. Note that the "TourneyStart" event will be added in the next update.

Code: Select all

<?php
  $pw = $_POST["Password"];
  if ($pw != "test") exit;
  $f = fopen("Callback.txt","a");
  $event = $_POST["Event"];
  switch ($event)
  {
    case "Login":
      fwrite($f,"Event = " . $event . "\n");
      fwrite($f,"Player = " . $_POST["Player"] . "\n");
      fwrite($f,"Time = " . $_POST["Time"] . "\n");
      fwrite($f,"\n");
      break;
    case "Logout":
      fwrite($f,"Event = " . $event . "\n");
      fwrite($f,"Player = " . $_POST["Player"] . "\n");
      fwrite($f,"Time = " . $_POST["Time"] . "\n");
      fwrite($f,"\n");
      break;
    case "TourneyStart":
      fwrite($f,"Event = " . $event . "\n");
      fwrite($f,"Name = " . $_POST["Name"] . "\n");
      fwrite($f,"Time = " . $_POST["Time"] . "\n");
      fwrite($f,"\n");
      break;
    case "TourneyFinish":
      fwrite($f,"Event = " . $event . "\n");
      fwrite($f,"Name = " . $_POST["Name"] . "\n");
      fwrite($f,"Time = " . $_POST["Time"] . "\n");
      fwrite($f,"\n");
      break;
    case "RingGameError":
      fwrite($f,"Event = " . $event . "\n");
      fwrite($f,"Name = " . $_POST["Name"] . "\n");
      fwrite($f,"Error = " . $_POST["Error"] . "\n");
      fwrite($f,"Time = " . $_POST["Time"] . "\n");
      fwrite($f,"\n");
      break;
    case "TourneyError":
      fwrite($f,"Event = " . $event . "\n");
      fwrite($f,"Name = " . $_POST["Name"] . "\n");
      fwrite($f,"Error = " . $_POST["Error"] . "\n");
      fwrite($f,"Time = " . $_POST["Time"] . "\n");
      fwrite($f,"\n");
      break;
    default:
      fwrite($f,"Unknown event: " . $event . "\n");
      fwrite($f,"\n");
      break;
  }
  fclose($f);
?>
MonTheHoops
Posts: 48
Joined: Sat Jun 21, 2008 3:39 pm

Re: Callback Feature

Post by MonTheHoops »

Thanks Kent,

Just tried it but no joy at the moment, I'll try again later.

I uploaded a file containing the info above and called it callback.php, I set up the server to enable callbacks to the URL including that file, checked file permissions but nothing wrote to callback.txt when I log in.

Any more pointers?

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

Re: Callback Feature

Post by Kent Briggs »

MonTheHoops wrote:I uploaded a file containing the info above and called it callback.php, I set up the server to enable callbacks to the URL including that file, checked file permissions but nothing wrote to callback.txt when I log in.
Did you set the password to "test" or fix that line to match yours? If you change all the $_POST commands to $_REQUEST, you could test it with your browser by including the parameters in the URL. Something like:

Code: Select all

http://xxx.xxx.xxx.xxx/callback.php?Password=test&Event=Login&Player=test&Time=2010-02-02 00:00:00
Also if your PHP script is on a Linux system, remember that file names are case sensitive so Callback.php <> callback.php
MonTheHoops
Posts: 48
Joined: Sat Jun 21, 2008 3:39 pm

Re: Callback Feature

Post by MonTheHoops »

Ok, that test worked and it wrote to the callback.txt file, so what does that tell us?

And what do I need to do to make it work as it should now?

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

Re: Callback Feature

Post by Kent Briggs »

MonTheHoops wrote:Ok, that test worked and it wrote to the callback.txt file, so what does that tell us?
Can you get your site to list at http://www.pokermavens.net ? The server makes an HTTP call to do that so it should tell you if there's a firewall issue or not.
MonTheHoops
Posts: 48
Joined: Sat Jun 21, 2008 3:39 pm

Re: Callback Feature

Post by MonTheHoops »

Kent Briggs wrote:
MonTheHoops wrote:Ok, that test worked and it wrote to the callback.txt file, so what does that tell us?
Can you get your site to list at http://www.pokermavens.net ? The server makes an HTTP call to do that so it should tell you if there's a firewall issue or not.
I lost the password to do that Kent, sorry.

What ports need to be open in order for that to work? 8087 and 8088?

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

Re: Callback Feature

Post by Kent Briggs »

MonTheHoops wrote:I lost the password to do that Kent, sorry.
What ports need to be open in order for that to work? 8087 and 8088?
You just need your Directory Key. Send me an email. It's an outgoing connection so there's no ports to open.
MonTheHoops
Posts: 48
Joined: Sat Jun 21, 2008 3:39 pm

Re: Callback Feature

Post by MonTheHoops »

ok, I'm listing on PokerMavens.net now.....
MonTheHoops
Posts: 48
Joined: Sat Jun 21, 2008 3:39 pm

Re: Callback Feature

Post by MonTheHoops »

and suddenly it has all started working.......no idea how but there ya go.

Cheers Kent

Paul
Post Reply