Facebook API can't display my name

I copy and pasted the Facebook API’s sample code. It is supposed to display the logged-in user’s name and 10 of his friends. The friends’ IDs are showing up but his name is not being printed out.


<html>
     <body>
<?php
        require_once 'facebook/php/facebook.php';

        $appapikey = 'XXXXXXXXXXXXXXXXXX';
        $appsecret = 'XXXXXXXXXXXXXXXXXX';
        $facebook = new Facebook($appapikey, $appsecret);
        $user_id = $facebook->require_login();

        // Greet the currently logged-in user!
        echo "<p>Hello, <fb:name uid=\"$user_id\" useyou=\"false\" />!</p>";

        // Print out at most 10 of the logged-in user's friends,
        // using the friends.get API method
        echo "<p>Friends:";
        $friends = $facebook->api_client->friends_get();
        $friends = array_slice($friends, 0, 10);
        foreach ($friends as $friend) {
          echo "<br>$friend";
        }
        echo "</p>";

?>
        <fb:login-button v="2" size="medium" onlogin="window.location.reload(true);">Connect with Facebook</fb:login-button>
    </body>
    <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US" type="text/javascript"></script>
    <script type="text/javascript">FB.init("c25d7da26bc289812c03c96763be6c66");</script>
</html>

I also was unable to display the user’s avatar. It just showed the default anonymous avatar. What’s the big deal?