Ok, so I am trying out my first Facebook app, a hello worldesque construction. Here’s my code:
require_once 'facebook.php';
$appapikey = 'YOUR APPLICATION KEY';
$appsecret = 'YOUR APPLICATION SECRET YOUR';
$facebook = new Facebook($appapikey, $appsecret);
$user_id = $facebook->getUser();
echo "<p>Hello, <fb:name uid=\"$user_id\" />";
However, the username doesn’t show! All it shows is:
Hello,
I would like a reliable method to pull the username!
You need to authenticate and connect with your app first. Here’s a tutorial explaining the whole process:
http://thinkdiff.net/facebook/php-sdk-3-0-graph-api-base-facebook-connect-tutorial/