MojangAPI
MojangAPI copied to clipboard
Doesn't work anymore at all
Does your API still work? Can't get it to do so.
This is my code:
<?php
// Require API
require 'mojangApi.php';
// Get UUID from username
$uuid = MojangAPI::getUuid('MTC');
echo 'UUID: <b>' . $uuid . '</b><br>';
// Get his name history
$history = MojangAPI::getNameHistory($uuid);
echo 'First username: <b>'.reset($history)['name'].'</b><br>';
// Print player's head
$img = '<img src="' . MojangAPI::embedImage(MojangAPI::getPlayerHead($uuid)) . '" alt="Head of MTC">';
echo 'Skin:<br>' . $img . '<br>';
?>
This is how the website looks like when it's loaded:
I read that warning but when I do:
if(MojangAPI::getUuid('Player')
it always returns false.
Encountered the same issue, I've discovered the issue is with the fetch()
function, curl attempts to get the contents from Mojang's API service however fails to do so.
Well I just tested the code you've given and it seems to work flawlessly: