Page 1 of 1

Callback Feature

Posted: Tue Feb 02, 2010 12:25 pm
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.

Re: Callback Feature

Posted: Tue Feb 02, 2010 12:56 pm
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);
?>

Re: Callback Feature

Posted: Tue Feb 02, 2010 1:53 pm
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

Re: Callback Feature

Posted: Tue Feb 02, 2010 2:05 pm
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

Re: Callback Feature

Posted: Tue Feb 02, 2010 4:45 pm
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

Re: Callback Feature

Posted: Tue Feb 02, 2010 5:00 pm
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.

Re: Callback Feature

Posted: Tue Feb 02, 2010 5:14 pm
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

Re: Callback Feature

Posted: Tue Feb 02, 2010 5:31 pm
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.

Re: Callback Feature

Posted: Wed Feb 03, 2010 6:06 am
by MonTheHoops
ok, I'm listing on PokerMavens.net now.....

Re: Callback Feature

Posted: Wed Feb 03, 2010 7:03 am
by MonTheHoops
and suddenly it has all started working.......no idea how but there ya go.

Cheers Kent

Paul