Привет, я пытаюсь возиться с API.Но я продолжаю получать эту странную ошибку, и я искал в Интернете, но я не могу исправить ее, пытаясь прочитать об ошибке.
Я получаю эту ошибку: Примечание: пытаюсь получить свойствонеобъект в C: \ xampp \ htdocs \ index.php в строке 22 * 1003 *
Вот строки с 17 по 28 index.php
$server = "localhost:8087";
$player = $_SESSION['username'];
$password = $_SESSION['password'];
$params = array("Command" => "AccountsPassword", "Player" => $player, ":", "PW" => $password);
$api = Poker_API($params);
if ($api -> Result != "Ok") die($api -> Error . "<br/>" . "Go to the homepage to try again.");
if ($api -> Verified != "Yes") die("Password is incorrect. Go to the homepage to try again.");
$params = array("Command" => "AccountsSessionKey", "Player" => $player);
$api = Poker_API($params);
if ($api -> Result != "Ok") die($api -> Error . "<br/>" . "Go to the homepage to try again.");
$key = $api -> SessionKey;
$src = $server . "/?LoginName=" . $player . "&SessionKey=" . $key;
, а вот api.php
<?php
$url = "localhost:8087/api"; // Put your API path here
$pw = "Removed"; // put your API password here
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, true);
curl_close($curl);
print_r($response);
//echo implode($params);
return $obj;
}
?>