facebook-php-sdk

Information about current user in facebook

£可爱£侵袭症+ 提交于 2019-12-02 06:44:32
I am trying to get facebook userid of the users currently logged in. I used this below piece of code ang got error "Uncaught OAuthException: An active access token must be used to query information about the current user" require '../src/facebook.php'; $facebook = new Facebook(array( 'appId' => '226668060741665', 'secret' => 'secret key', )); $rr=$facebook->getAccessToken(); $params = array( 'access_token' => $rr, 'installed' => 'true', 'permissions' => 'read_stream,publish_stream' ); $eded=$facebook->api("/me/", "GET", $params); I tried to use Facebook::getLoginStatusUrl() but didnt get what

Facebook getUser() always returns 0 [PHP SDK 3.1.1] [duplicate]

二次信任 提交于 2019-12-02 05:18:47
问题 This question already has answers here : Why is Facebook PHP SDK getUser always returning 0? (26 answers) Closed 5 years ago . fb.php: ini_set('display_errors','On'); error_reporting(E_ALL); require_once 'facebook/src/facebook.php'; $facebook = new Facebook( array ( 'appId' => '****', 'secret' => '****', 'cookie' => true ) ); $user = $facebook->getUser(); if ($user) { var_dump($user); $logoutUrl = $facebook->getLogoutUrl(); print '<a href="'.$logoutUrl.'">Logout</a>'; } else { $loginUrl =

signedRequest doesn't return if user has liked the page

本秂侑毒 提交于 2019-12-02 03:04:16
Hello I am developing an fb app using facebook sdk (php version) but for some reason the signedRequest doesn't return me the liked variable in order to determine if the user has liked the page. Below is the print_r of signedrequest : Array ( [id] => 395466473895310 [admin] => 1 ) any help appretiated thanks John https://developers.facebook.com/docs/apps/changelog The 'liked' property will no longer be returned in the 'signed_request' object for Page Tab apps created after today. From November 5, 2014 onwards, the 'liked' property will always return 'true' regardless of whether or not the

Facebook account delink or deauthorize facebook app and check status of linking from facebook app

时光怂恿深爱的人放手 提交于 2019-12-02 02:36:52
My website application having feature login with Facebook login. And for which my app is present on Facebook. Login with facebook is working fine. But application have feature of linking and unlinking facebook account to Facebook app. How to check FB account is linked with specific FB app or not? And how to unlink FB account from specific FB app if linked (On that user's request )? ("Linked" means we select "Allow" to FB app on request) With the new Graph there is a documented way to deauthorize (I've tested it in the Graph API explorer and it works). Send an HTTP Delete command to "me

Facebook Open Graph API returns: (#200) Requires extended permission: publish_actions

我们两清 提交于 2019-12-02 01:51:37
I am trying to publish actions to a user's wall using the Open Graph API. I requested the 'publish_actions' permission, enabled the 'Enhanced Auth Dialog', my role is set to 'developer' and my app settings show 'This app may post on your behalf, including pictureabcs you viewabcked and more.'. Requesting $facebook->api('/me/permissions'); returns array(1) { ["data"]=> array(1) { [0]=> array(2) { ["installed"]=> int(1) ["publish_actions"]=> int(1) } } } However, when I send the following post request $data = array(); $data['access_token'] = $facebook->getAccessToken(); $data['pictureabc'] =

how to hide page post using facebook api

≡放荡痞女 提交于 2019-12-01 23:59:16
I have this code and It's from this link https://developers.facebook.com/docs/reference/api/page/ (Please see 'Hiding a Page Post') I don't have any error but my problem is, this code is not working. the page post is still not hidind Below is my code: $fanpage_credit = array( 'access_token' => $page_token, 'is_hidden' => true ); $fanpage_post_url = '/'.$post_id; $postResult = $facebook->api($fanpage_post_url, 'post', $fanpage_credit ); echo 'HIDE SUCCESS '.time(); I look forward for answers. thanks! You can hide the post after you have posted it: $fanpage_credit = array( 'access_token' =>

Extending Access Token Expiration not functioning

两盒软妹~` 提交于 2019-12-01 21:49:15
I am at the intermediate level in php and am new with facebook development. I have looked through the facebook documents and Stack Overflow previous comments. All I basically wanted to do was let the user log in with their Facebook account and display their name. My php page has a graph, and the page auto refreshes every 2 or 5 min. I authenticate and get the facebook first_name to put on the page. $graph = $facebook->api('/me'); echo $graph['first_name'] to get the first name of the user .. (for which I thought that no access token was required). After about 90 min. I have been receiving the

facebook post on page wall - PHP SDK

自作多情 提交于 2019-12-01 19:33:49
I'm trying to create a script that post on a facebook page (as an administrator) a status. This is the script i'm using: try { $access_token = (new FacebookRequest( $session, 'GET', '/' . $pageID, array( 'fields' => 'access_token' ) )) ->execute()->getGraphObject()->asArray(); $access_token = $access_token['access_token']; $page_post = (new FacebookRequest( $session, 'POST', '/'. $pageID .'/feed', array( 'access_token' => $access_token, 'message' => $message, ) ))->execute()->getGraphObject()->asArray(); } catch (FacebookRequestException $e) { echo 'ERROR! ' . __LINE__ . $e->getMessage(); }

OAuthException : An active access token must be used to query information about the current user

百般思念 提交于 2019-12-01 17:50:02
I'm trying to run the sample code for Facebook connect that I downloaded from http://thinkdiff.net/facebook/php-sdk-3-0-graph-api-base-facebook-connect-tutorial/ I get this error message : [error] => Array ( [message] => An active access token must be used to query information about the current user. [type] => OAuthException [code] => 2500 ) You can try on my website : http://facebook.oliverjordan.net/thinkdiff Here is the fbmain.php code : <?php //facebook application $fbconfig['appid' ] = "463007877113xxx"; $fbconfig['secret'] = "-sensor-"; $fbconfig['baseurl'] = "http://facebook

Not getting email from facebook API while login

泄露秘密 提交于 2019-12-01 16:30:50
I have a problem while login i can't get email even while adding email to User & Friend Permissions (for some facebook accounts). i'm using facebook-php-sdk, this the code that im using $facebook_user_profile = $facebook->api('/me', array('fields' => 'id,email,first_name,last_name,picture')); please can any one save my day ? Apart from what CBroe commented about asking for the permissions using the "scope" parameter while logging in to grab permissions , you must also consider the fact that not every logged in user (or a user allowing your application to access their info) has an email