API account creation trouble
API account creation trouble
I'm trying to use the php script to create new accounts from my site with the API, and i'm pretty sure i have all the connection info right. But anytime i try to create and account and click submit, it says "Error: Connection failed" which is coming from the API.php and the "associative array result." What does this most likely mean? The character creation connected and pulled the avatar pictures just fine... is the Connection url information is incorrect or something? Anything to do with php's "Curl"? I don't see a specific error for that though. I hope it doesnt have anything to do with the php on my webhost
-
- Site Admin
- Posts: 5880
- Joined: Wed Mar 19, 2008 8:47 pm
Re: API account creation trouble
It could be a number of things. Make sure "Enable API" is set to Yes under the Server Settings group. In the API.php file, make sure you replaced the sample URL with yours and that it includes the proper File Port with "/api" on the end. Make sure the curl extension is installed in the PHP setup. Run a sample PHP program to check:Krustbox wrote:I'm trying to use the php script to create new accounts from my site with the API, and i'm pretty sure i have all the connection info right. But anytime i try to create and account and click submit, it says "Error: Connection failed" which is coming from the API.php and the "associative array result." What does this most likely mean? The character creation connected and pulled the avatar pictures just fine... is the Connection url information is incorrect or something? Anything to do with php's "Curl"? I don't see a specific error for that though. I hope it doesnt have anything to do with the php on my webhost
Code: Select all
<?php
phpinfo();
?>
Re: API account creation trouble
APi enabled, Curl enabled, i'm hosting the server from my own computer next to me so ports are open because i can connect and play just fine, even from other computers and locations. I use the same url that i use to connect and play with /api on the end, i've tried both ports and neither work. I mean if i'm able to connect to the server and play then this whole thing should work fine shouldn't it?
-
- Site Admin
- Posts: 5880
- Joined: Wed Mar 19, 2008 8:47 pm
Re: API account creation trouble
Try running this curl test code I found and see if it displays the text of Google's home page:Krustbox wrote:APi enabled, Curl enabled, i'm hosting the server from my own computer next to me so ports are open because i can connect and play just fine, even from other computers and locations. I use the same url that i use to connect and play with /api on the end, i've tried both ports and neither work. I mean if i'm able to connect to the server and play then this whole thing should work fine shouldn't it?
Code: Select all
<?php
function DownloadUrl($Url)
{
if (!function_exists('curl_init')) die('CURL is not installed!');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $Url);
curl_setopt($ch, CURLOPT_REFERER, "http://www.google.com/");
curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
echo DownloadUrl("http://www.google.com");
?>
Re: API account creation trouble
Yeah i see everything from google's page, except the image logo is replaced with the text, "Google"
-
- Site Admin
- Posts: 5880
- Joined: Wed Mar 19, 2008 8:47 pm
Re: API account creation trouble
We know curl is working then. So is the server hosting PHP on the same local network as the one hosting the poker server? If so are you using a local area IP like this at the top of your API.php file:Krustbox wrote:Yeah i see everything from google's page, except the image logo is replaced with the text, "Google"
$url = "http://192.168.x.x:8087/api";
where x.x is your actual values.
Re: API account creation trouble
No i'm using hostgator for the site using php, the server is hosted from my house and called by my actual IP, not the local router ip, but the actual one. I've opened the ports in my router. I use the file port, not the packet port, right? I think i've tried both
-
- Site Admin
- Posts: 5880
- Joined: Wed Mar 19, 2008 8:47 pm
Re: API account creation trouble
Oh ok, I misunderstood before. It could be that the hostgator firewall is blocking outgoing connections to non-standard ports. You might double check with them to make sure. Or if possible, change your File Port setting (and corresponding router firewall) to 80 temporarily and see if that works. If it does, that would confirm a firewall issue with port 8087.Krustbox wrote:No i'm using hostgator for the site using php
Correct, the API goes to Poker Mavens' HTTP server, which is on its File Port.I use the file port, not the packet port, right? I think i've tried both
Re: API account creation trouble
k i think that might be the problem, i'll contact my host and see what i can do. thanks for your help so far i'll be sure to post results here when i can.
Re: API account creation trouble
THAT FIXED THE PROBLEM. IT"S WORKING NOW. THANK YOU VERY MUCH. LIFE IS GOOD. seriously this is awesome. AWESOME.