MojangAPI icon indicating copy to clipboard operation
MojangAPI copied to clipboard

Doesn't work anymore at all

Open realmayus opened this issue 6 years ago • 2 comments

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: image

I read that warning but when I do:

if(MojangAPI::getUuid('Player')

it always returns false.

realmayus avatar Jan 10 '19 13:01 realmayus

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.

ImSkully avatar Jun 04 '19 01:06 ImSkully

Well I just tested the code you've given and it seems to work flawlessly:

image

MineTheCube avatar Sep 22 '19 15:09 MineTheCube