API Examples

For general discussion of the Poker Mavens software
Post Reply
michaelmlevin
Posts: 57
Joined: Thu Apr 09, 2020 12:23 pm

API Examples

Post by michaelmlevin »

I've set up a website using the latest WordPress (www.splashpoker.org) for the support for my poker site (splash.poker). The wordpress site has structure sheets, tournament results, information, etc. I thought it would be nice to implement some of the sample API functions (on a private page, only for admins) to display results, etc. So I installed a plugin that allows me to embed php scripts (Insert PHP Code Snippet), and I installed the API.php file (modified for my site, with my password) in the plugin directory, so I don't get a file-not-found error.

No matter which sample script I try, I get an error. I thought I would try purposely messing up the password in API.php to see if that caused it to not connect, but it changed nothing-- Error.

I am running php 7.3 and (as far as I've been able to determine) curl is enabled. Is there any script that would simply allow me to verify that API.php is responding correctly? I have seen errors (which I can't reproduce right now) suggesting that the JSON response was not formatted properly.

I don't think this is a problem with any of your code. I think either I'm doing something fundamentally wrong or there is some sort of compatibility issue.

Any help or direction would be sincerely appreciated.
Kent Briggs
Site Admin
Posts: 5880
Joined: Wed Mar 19, 2008 8:47 pm

Re: API Examples

Post by Kent Briggs »

What exactly was the error? A lot of PHP installations from shared-host web sites have an outgoing link firewall that may block attempts to connect to any ports other than 80 or 443. What is your File Port setting in Poker Mavens?
michaelmlevin
Posts: 57
Joined: Thu Apr 09, 2020 12:23 pm

Re: API Examples

Post by michaelmlevin »

443.

I can’t tell what the error is: just Error
Kent Briggs
Site Admin
Posts: 5880
Joined: Wed Mar 19, 2008 8:47 pm

Re: API Examples

Post by Kent Briggs »

Are you able to use the API Reference Utility to make a test API call? Just to make sure the issue is not on the server side.

http://www.briggsoft.com/docs/pmavens/U ... htm#apiref
michaelmlevin
Posts: 57
Joined: Thu Apr 09, 2020 12:23 pm

Re: API Examples

Post by michaelmlevin »

I've been using the API reference utility. It works perfectly. That's why I wanted to facilitate something more. . .
michaelmlevin
Posts: 57
Joined: Thu Apr 09, 2020 12:23 pm

Re: API Examples

Post by michaelmlevin »

Is there a test poker maven server I could point API.php to to make a test api call where you could tell what's going on? I THINK I'm getting back null data, but I'm not really able to debug what's going on. If the api call successfully logs in, is that something that should be reflected in my log? Is there something, somewhere, I can look to to identify what the heck it's doing??

ANY help would be appreciated.
Kent Briggs
Site Admin
Posts: 5880
Joined: Wed Mar 19, 2008 8:47 pm

Re: API Examples

Post by Kent Briggs »

All API connections are logged in the Event Log (or Error Log), including attempts that failed due to invalid API password. If nothing is there then you never made any kind of connection to the server. You need to modify your plug-in and make it report a better error message.
michaelmlevin
Posts: 57
Joined: Thu Apr 09, 2020 12:23 pm

Re: API Examples

Post by michaelmlevin »

Just to close this thread, the problem apparently lies in WordPress and/or the theme it's using. I created a subdirectory right under my public html address called pksrv. Into pksrv I put the API.php and several of the sample scripts. I then simply typed http://splashpoker.org/pksrv/scriptname.php and VOILA! It worked. So I'm now trying to figure out where WordPress is interfering with the operation but that's not for this forum. Just wanted closure.
mudbuddha
Posts: 14
Joined: Fri Apr 10, 2020 3:28 pm

Re: API Examples

Post by mudbuddha »

this is awesome.

I would love to have a tournaments result page like that.

would you share how you listed them out there?
Post Reply