facebook-php-sdk

Facebook graph API loop through paging

廉价感情. 提交于 2019-12-03 07:48:09
问题 So I was working with this script to loop through the events from a given page. Suddenly I find it doesn't work anymore :( I have a feeling it could be a bug, because if you pick any page, view events with an access_token, you can't get any data back for the "next" paginated URL. e.g. try https://graph.facebook.com/evenightclub/events in apigee.com Any ideas? ($fid is the page object id) try { $facebook = new Facebook(array( 'appId' => '<removed>', 'secret' => '<removed>', )); $access_token =

Facebook PHP SDK - will not logout properly

可紊 提交于 2019-12-03 07:34:19
I've been searching for hours for the solution to this problem but can't find one that works for me. When i click "Logout" on my site the user information is still visible and the logout button is still displayed. Here is the code: require 'facebook-php-sdk/src/facebook.php'; $facebook = new Facebook(array( 'appId' => 'xxxx', 'secret' => 'xxxx', )); // Get User ID $user = $facebook->getUser(); var_dump($user); if ($user) { try { // Proceed knowing you have a logged in user who's authenticated. $user_profile = $facebook->api('/me'); } catch (FacebookApiException $e) { error_log($e); $user =

FacebookSDKException: Session not active, could not store state

本秂侑毒 提交于 2019-12-03 06:37:34
I don't understand why I'm getting this exceptions: Session not active, could not store state. The code is: <?php require 'vendor/autoload.php'; use Facebook\FacebookSession; use Facebook\FacebookRedirectLoginHelper; FacebookSession::setDefaultApplication('foo', 'baz'); $helper = new FacebookRedirectLoginHelper('bar'); $loginUrl = $helper->getLoginUrl(); ?> Please help. You need to start a session using session_start() for the Facebook SDK to work correctly. Please add this to your code to fix the issue. Example: <?php session_start(); require 'vendor/autoload.php'; use Facebook

Facebook PHP SDK Upload Photos

陌路散爱 提交于 2019-12-03 04:56:27
Trying to upload a photo rendered on my server to the facebook album of the user on the fly. Since FB Docs are very,very,very bad (to say the least) I was hoping for someone to show me some good code examples of Graph API calls with the PHP SDK? Something like this. try { $facebook->setFileUploadSupport('http://www.example.com/'); $response = $facebook->api( '/me/photos/', 'post', array( 'message' => 'This is my image caption', 'source' => '@/path/to/image' // @-sign must be the first character ) ); } catch (FacebookApiException $e) { error_log('Could not post image to Facebook.'); } EDIT:

Facebook Authentication Implementation

爷,独闯天下 提交于 2019-12-03 04:33:18
I'm working on a project which will use facebook authentication completely (no custom authentication implementation exists). Project uses PHP for server-side scripting. I looked around for implementing fast and secure authentication mechanism but i cannot find any detailed description about this subject. Facebook's documents are weak and does only provide basic information. Which authentication method would be appropriate? There's a Javascript SDK and PHP SDK. As i understand, i have to use Javascript SDK for login, then using PHP SDK i will check my database for verifying credentials. But

How to get user profile info using access token in php-sdk

喜欢而已 提交于 2019-12-03 04:06:13
I want to get user profile using access token that i have already generated , and if the access token is invalid it shoud display error. anyone can help to do this ? i want php code to handle this. i am waiting.... Since you already have the access token , the simplest and clean way would be- $user_details = "https://graph.facebook.com/me?access_token=" .$access_token; $response = file_get_contents($user_details); $response = json_decode($response); print_r($response); First check if the user is logged in $facebook = new Facebook(array( 'appId' => 'AppIDHere', 'secret' => 'AppSecretHere', ));

How to login with OFFLINE_ACCESS using the new Facebook PHP SDK 3.0.0?

泪湿孤枕 提交于 2019-12-03 03:21:14
问题 with the old (2.x) SDK I used this to log someone with offline_access: $session = array ( 'uid' => $userdata['fb_uid'], 'sig' => $userdata['fb_sig'], 'access_token' => $userdata['fb_access_token'] ); $facebook->setSession($session); In the new SDK this function doesnt exist anymore. I think I need to login using: setPersistentData($key, $value) but this function is protected and I dont know what 'code' is? Do I need this to log the user in or not? And what's going on with 'sig'? Don't I need

Match facebook campaign objective with insights actions types

倾然丶 夕夏残阳落幕 提交于 2019-12-03 03:06:07
Facebook campaigns have an objective among those listed here ( PAGE_LIKES , VIDEO_VIEWS , etc). Facebook insights list users actions among those listed here ( like , video_view , etc, but some are missing, unlike for example). The problem is: objective and actions do not match. For example, there is a PAGE_LIKES objective and a like action. In the facebook power manager there is a "Results" column which gives, for each campaign, the user actions count that match the campaign objective ( 992 like obtained in the picture below ). It seems that there is no such things in the insights ( neither in

Facebook Auth Dialog: Developer warning concerning the use of “display” type “popup”

我的未来我决定 提交于 2019-12-03 01:17:37
starting today we receive developer warnings in the auth dialog with the following message: You are using a display type of 'popup' in a large browser window or tab. For a better user experience, show this dialog with our JavaScript SDK without specifying an explicit display type. The SDK will choose the best display type for each environment. Alternatively, set height and width on your window.open() call to properly size this dialog if you have special requirements precluding you from using the SDK. This message is only visible to developers of your application. We have the following

Weird url appended “#_=_” [duplicate]

。_饼干妹妹 提交于 2019-12-03 01:03:10
This question already has answers here : Play Framework appending #_=_ to redirect after Facebook auth via OAuth2? (2 answers) Possible Duplicate: Play Framework appending # = to redirect after Facebook auth via OAuth2? Has anyone else seen this happen? I am building a Facebook canvas app using the Facebook PHP SDK, and some Javascript. Now when I take the user through the OAuth authentication flow, I have noticed that the URL in the browser automatically gets appended with this "#_=_" , so my URL starts looking like this: http://apps.facebook.com/xxxxxxxxxxxx/#_=_ and when I redirect to the