Post Malone
Premium
Salut
!
J'aimerais faire un script qui récupère les anciens pseudo d'un joueur MC grace a son UUID, pour ca j'utilise l'api mojang.
J'ai commencé le code, mais j'obtiens les erreurs :
- "Notice: Trying to get property of non-object in C:\wamp\www\playeruuid.php on line 19"
- "Notice: Trying to get property of non-object in C:\wamp\www\playeruuid.php on line 25"
Voila le code :
Pouvez-vous m'aider a rectifier cela ?
Merci d'avance
J'aimerais faire un script qui récupère les anciens pseudo d'un joueur MC grace a son UUID, pour ca j'utilise l'api mojang.
J'ai commencé le code, mais j'obtiens les erreurs :
- "Notice: Trying to get property of non-object in C:\wamp\www\playeruuid.php on line 19"
- "Notice: Trying to get property of non-object in C:\wamp\www\playeruuid.php on line 25"
Voila le code :
PHP:
<form method="post" action="playeruuid.php">
<input type="text" name="uuid">
</form>
<div class="container">
<!-- Tableau réusltats -->
<table class="table table-striped table-hover ">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>Changed To At</th>
</tr>
</thead>
<tbody>
<?php
$json = file_get_contents('https://api.mojang.com/user/profiles/' . $_POST['uuid'] . '/names');
$decoded = json_decode($json);
//Ligne 19
if(sizeof($decoded->results) > 41)
{
$ok = 41;
}
else
{
//Ligne 25
$ok = sizeof($decoded->results);
}
for ($i=1; $i < $ok; $i++) {
if($decoded->results[$i]->name != null)
{
?>
<tr>
<td><?= $i ?></td>
<td><?= $decoded->results[$i]->name ?></td>
<td><?= $decoded->results[$i]->changedToAt ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
Pouvez-vous m'aider a rectifier cela ?
Merci d'avance