API Error: No password specified

For discussion of the Poker Mavens server module and other administration topics
Post Reply
Ziusz
Posts: 2
Joined: Fri May 01, 2015 4:50 pm

API Error: No password specified

Post by Ziusz »

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
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: API Error: No password specified

Post by Kent Briggs »

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" => "",
Ziusz
Posts: 2
Joined: Fri May 01, 2015 4:50 pm

Re: API Error: No password specified

Post by Ziusz »

Yeah, this was problem with player's password.
But I have second error now.
Error: malformed
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: API Error: No password specified

Post by Kent Briggs »

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.
Post Reply