API Error: No password specified

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

API Error: No password specified

Postby Ziusz » Fri May 01, 2015 6:03 pm

Hello,
I have problem with API.
Result=Error
Error=No password specified

Code: Select all
  $url = "http://185.49.14.200:8087/api";
  $pw = "......................";

  function Poker_API($params)
  {
    global $url, $pw;
    $params['Password'] = $pw;
    $params['JSON'] = 'Yes';
    $curl = curl_init($url);
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($params));
    curl_setopt($curl, CURLOPT_TIMEOUT, 30);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_VERBOSE, true);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    $response = curl_exec($curl);
    if (curl_errno($curl)) $obj = (object) array('Result' => 'Error', 'Error' => curl_error($curl));
    else if (empty($response)) $obj = (object) array('Result' => 'Error', 'Error' => 'Connection failed');
    else $obj = json_decode($response);
    curl_close($curl);
    return $obj;
  }
   $steamid = $auth->SteamID;
   $stmt = $pdo->prepare("SELECT steamid, coins, personaname, avatarmedium FROM users WHERE steamid = :steamid");
   $stmt -> bindValue(':steamid', $steamid, PDO::PARAM_INT);
    $stmt -> execute();
   
   while($row = $stmt -> fetch(PDO::FETCH_ASSOC)){
    $coins = $row['coins'];
   $avatar = $row['avatarmedium'];
   $personaname = $row['personaname'];}

   $params = array("Command"  => "AccountsAdd",
                    "Player"   => $personaname,
               "RealName" => "",
               "PW"       => "",
               "Location" => "",
               "Email"    => "",
                    "AvatarFile" => $avatar,
               "Gender"   => "Male",
                    "Chat"     => "Yes",
                    "Note"     => "");
    $api = Poker_API($params);
   if ($api -> Result == "Ok") echo "Account successfully created for $Player";
    else echo "Error: " . $api -> Error;
}


If I have link http://[iphere]/api?Password=[passwordhere]&Command=AccountsAdd&Player=Test
I also have such problem
Ziusz
 
Posts: 2
Joined: Fri May 01, 2015 4:50 pm

Re: API Error: No password specified

Postby Kent Briggs » Fri May 01, 2015 6:36 pm

Ziusz wrote:Error=No password specified


It's referring to the player's password (PW) which you set to an empty string here:

$params = array("Command" => "AccountsAdd",
"Player" => $personaname,
"RealName" => "",
"PW" => "",
Kent Briggs - [email protected]
Briggs Softworks - http://www.briggsoft.com
Kent Briggs
Site Admin
 
Posts: 3829
Joined: Wed Mar 19, 2008 8:47 pm

Re: API Error: No password specified

Postby Ziusz » Fri May 01, 2015 6:54 pm

Yeah, this was problem with player's password.
But I have second error now.
Error: malformed
Ziusz
 
Posts: 2
Joined: Fri May 01, 2015 4:50 pm

Re: API Error: No password specified

Postby Kent Briggs » Fri May 01, 2015 10:49 pm

Ziusz wrote:Yeah, this was problem with player's password.
But I have second error now.
Error: malformed


Sounds like a php code error on your end. There are no API error messages in Poker Mavens that use that word.
Kent Briggs - [email protected]
Briggs Softworks - http://www.briggsoft.com
Kent Briggs
Site Admin
 
Posts: 3829
Joined: Wed Mar 19, 2008 8:47 pm


Return to Site Administration

Who is online

Users browsing this forum: No registered users and 12 guests

cron