API account creation trouble

For discussion of the Poker Mavens server module and other administration topics

API account creation trouble

Postby Krustbox » Thu Aug 26, 2010 4:32 pm

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
Krustbox
 
Posts: 18
Joined: Mon Oct 26, 2009 10:00 pm

Re: API account creation trouble

Postby Kent Briggs » Thu Aug 26, 2010 5:13 pm

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


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:

Code: Select all
<?php
  phpinfo();
?>


Also check with your host provider and make sure there isn't a firewall setting blocking outgoing connections, particular to that port.
Kent Briggs - [email protected]
Briggs Softworks - http://www.briggsoft.com
Kent Briggs
Site Admin
 
Posts: 3925
Joined: Wed Mar 19, 2008 8:47 pm

Re: API account creation trouble

Postby Krustbox » Thu Aug 26, 2010 5:55 pm

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?
Krustbox
 
Posts: 18
Joined: Mon Oct 26, 2009 10:00 pm

Re: API account creation trouble

Postby Kent Briggs » Thu Aug 26, 2010 6:49 pm

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?


Try running this curl test code I found and see if it displays the text of Google's home page:

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");

?>
Kent Briggs - [email protected]
Briggs Softworks - http://www.briggsoft.com
Kent Briggs
Site Admin
 
Posts: 3925
Joined: Wed Mar 19, 2008 8:47 pm

Re: API account creation trouble

Postby Krustbox » Thu Aug 26, 2010 6:51 pm

Yeah i see everything from google's page, except the image logo is replaced with the text, "Google"
Krustbox
 
Posts: 18
Joined: Mon Oct 26, 2009 10:00 pm

Re: API account creation trouble

Postby Kent Briggs » Thu Aug 26, 2010 8:18 pm

Krustbox wrote:Yeah i see everything from google's page, except the image logo is replaced with the text, "Google"


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:

$url = "http://192.168.x.x:8087/api";

where x.x is your actual values.
Kent Briggs - [email protected]
Briggs Softworks - http://www.briggsoft.com
Kent Briggs
Site Admin
 
Posts: 3925
Joined: Wed Mar 19, 2008 8:47 pm

Re: API account creation trouble

Postby Krustbox » Thu Aug 26, 2010 8:52 pm

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
Krustbox
 
Posts: 18
Joined: Mon Oct 26, 2009 10:00 pm

Re: API account creation trouble

Postby Kent Briggs » Thu Aug 26, 2010 9:17 pm

Krustbox wrote:No i'm using hostgator for the site using php


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.

I use the file port, not the packet port, right? I think i've tried both


Correct, the API goes to Poker Mavens' HTTP server, which is on its File Port.
Kent Briggs - [email protected]
Briggs Softworks - http://www.briggsoft.com
Kent Briggs
Site Admin
 
Posts: 3925
Joined: Wed Mar 19, 2008 8:47 pm

Re: API account creation trouble

Postby Krustbox » Thu Aug 26, 2010 9:28 pm

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.
Krustbox
 
Posts: 18
Joined: Mon Oct 26, 2009 10:00 pm

Re: API account creation trouble

Postby Krustbox » Thu Aug 26, 2010 9:43 pm

THAT FIXED THE PROBLEM. IT"S WORKING NOW. THANK YOU VERY MUCH. LIFE IS GOOD. :D seriously this is awesome. AWESOME.
Krustbox
 
Posts: 18
Joined: Mon Oct 26, 2009 10:00 pm


Return to Site Administration

Who is online

Users browsing this forum: Baidu [Spider] and 7 guests

cron