Page 1 of 1

API Examples

Posted: Mon May 04, 2020 7:27 pm
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.

Re: API Examples

Posted: Mon May 04, 2020 7:48 pm
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?

Re: API Examples

Posted: Mon May 04, 2020 8:36 pm
by michaelmlevin
443.

I can’t tell what the error is: just Error

Re: API Examples

Posted: Mon May 04, 2020 8:43 pm
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

Re: API Examples

Posted: Mon May 04, 2020 10:20 pm
by michaelmlevin
I've been using the API reference utility. It works perfectly. That's why I wanted to facilitate something more. . .

Re: API Examples

Posted: Tue May 05, 2020 5:09 pm
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.

Re: API Examples

Posted: Tue May 05, 2020 5:47 pm
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.

Re: API Examples

Posted: Thu May 07, 2020 7:34 pm
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.

Re: API Examples

Posted: Sat May 09, 2020 4:29 pm
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?