Hi welcome friends we are here for learning the Facebook Graph API to develop the Facebook applications. In previous tutorial we have learn how to create a Facebook Application...
Learn
Creating Your First Facebook App
In this Tutorial we will learn how to access the Facebook App user's name and profile picture using your Facebook App using Facebook Graph API with PHP sdk...
Here is a simple code to access the Facebook App User's Name and Profile Pic...
Hope you are understand this code and if you have any question regarding this code then you are free to ask ......
Read our more tutorials only on HowtoblogR.blogspot.com
Learn
Creating Your First Facebook App
In this Tutorial we will learn how to access the Facebook App user's name and profile picture using your Facebook App using Facebook Graph API with PHP sdk...
Here is a simple code to access the Facebook App User's Name and Profile Pic...
<html> <body> <?php $app_id = "YOUR APP ID"; $app_secret = "YOUR APP SECRET"; try { include_once ('libs/facebook.php'); } catch(Exception $o) { print_r($o); } $facebook = new Facebook(array( 'appId' => $app_id, 'secret' => $app_secret, 'cookie' => true )); $user = $facebook->getUser(); $loginUrl = $facebook->getLoginUrl(array ( 'scope' => 'email' ) ); if ($user) { try { $f=$facebook->api('/me'); $access_token = $facebook->getAccessToken(); } catch (FacebookApiException $e) { echo $e; $user = null; } } if (!$user) { echo "<script type='text/javascript'>top.location.href = '$loginUrl';</script>"; exit; } echo $f['name']."<br/><img src='https://graph.facebook.com/".$f['id']."/picture' width='50' height='50' />"; ?> </body> </html>
Hope you are understand this code and if you have any question regarding this code then you are free to ask ......
Read our more tutorials only on HowtoblogR.blogspot.com
Where to get include_once ('libs/facebook.php'); libs/faebook.php
ReplyDeleteHey sorry for long long long late reply, you can get this file from developers.facebook.com
DeleteThis code is working properly some time but many times when i am hit the url after that they access with facebook account then taken permission after that they only redirect not display name or profile pic http://xeniumdigital.in/xca/ftb/ this is the url
ReplyDeletehi, thanks for the tuts, i want to know how to create a facebook app to change the cover photo. eg
ReplyDeletei have a website with images and a button in each image with a link that allows the user change his cover profile photo just clicking that button, can you help me with that? i'm relative new with php and making facebook apps
Very informative, keep posting such good articles, it really helps to know about things.
ReplyDelete