facebook-php-sdk

Facebook PHP-SDK seems to lose userID after page refresh

浪尽此生 提交于 2019-12-08 01:49:07
问题 I've got login in working fine it seems, where I can login, accept the app (the first time) then display user information like name/picture/etc. When I refresh the page however, userid goes back to 0 and I have to login again - I'm not sure what the problem is, I must be reinitiating it every time the page loads or something? I dunno, I'll post some code- it might be tough as they are a bunch of separate files: fb_login.php - <?php require_once("fb_login/facebook.php"); $facebook = new

Facebook SDK PHP 5.0 getLoginUrl() Error 500

[亡魂溺海] 提交于 2019-12-07 13:46:36
问题 I am trying to use the examples provided under Facebook PHP SDK 5.0 to login to Facebook. I am getting back 500 Internal Server Error. I am using the Baby Plan from HostGator which is running Php 5.5.27 PHP INFO . Is there configuration I would need to add to my server to get things working? login.php <?php session_start(); // Include the required dependencies. require_once( 'vendor/autoload.php' ); // Initialize the Facebook PHP SDK v5. $fb = new Facebook\Facebook([ 'app_id' =>

Check if a Facebook user likes a page using fql

北慕城南 提交于 2019-12-07 12:42:02
问题 I want to check whether the loggedIn user has liked a specified page or not. Below is my code. $fql_pageid = "SELECT url,site,id FROM object_url WHERE url IN('http://developers.facebook.com/')"; $api_pageid = $facebook->api(array( 'method' => 'fql.query', 'query' => $fql_pageid )); $pageid = $api_pageid[0]["id"]; //get id of the specified page $fql_like = 'SELECT object_id FROM like WHERE user_id=me()'; $api_like = $facebook->api(array( 'method' => 'fql.query', 'query' => $fql_like )); When I

Integrating facebook in php giving invalid signed request with oAuth data

喜你入骨 提交于 2019-12-07 11:58:59
问题 I am trying to integrate facebook php sdk Following is the code i have tried by reading The facebook tutorial // init app with app id (APPID) and secret (SECRET) FacebookSession::setDefaultApplication('APP ID','APP SECRET'); $helper = new FacebookCanvasLoginHelper(); try { $session = $helper->getSession(); } catch(FacebookRequestException $ex) { echo $ex; } catch(\Exception $ex) { echo $ex; } However what i get when i open the app on my canvas page as exception 'Facebook\FacebookSDKException'

creating event via facebook graph api

旧时模样 提交于 2019-12-07 10:32:53
问题 Is there any way to create facebook event via code (as of today), referred to the documentation : for v2.0 for v1.0 Publishing was possible in v1.0 but not in v2.0. Is there legacy API support which I can use to create facebook events ? Any help appreciated. 回答1: If your app is a Graph API v2.0 app (created after April 30th 2014), you don't have the possibility to create events anymore via the Graph API. If your app is v1.0, the possbility to create events will vanish on May 1st 2015. 来源:

FB Graph API query doesn't work in PHP SDK

怎甘沉沦 提交于 2019-12-07 06:56:38
问题 Graph API: 2.4 PHP SDK: "facebook/php-sdk-v4": "~5.0" I'd like to get details about a page via PHP and the PHP SDK. Using the query: $response = $fb->get('/' . $sPageID . '?fields=posts', $_SESSION['facebook_access_token']); returns the posts with a good amount of data. But unfortunately wrong values: The limit 25 for likes for instance applies here. So even if one post should have 150 likes, if I do an count ($post['likes']) I only get 25 as a result. So I tried to change my query and

Delete facebook post with Graph API - trouble getting this to work

痞子三分冷 提交于 2019-12-06 22:56:58
问题 I'm using the following to post a message on my Facebook page: $attachment = array( 'access_token' => $access_token, 'message' => 'This is a test Message 4:', 'name' => "This is a test Name 4", 'link' => "http://slashdot.org/", 'description' => "This is a test Description 4" ); $ret_code=$facebook->api('/me/feed', 'POST', $attachment); This works great. How do I delete the same post using the facebook GRAPH api? I read the docs and it says to issue a POST like: https://graph.facebook.com

Facebook PHP SDK not loading as a library in CodeIgniter

和自甴很熟 提交于 2019-12-06 16:56:43
I'm having a problem simply loading the Facebook PHP SDK (v3.1.1) as library in CodeIgniter 2.0. 1) I've put the latest Facebook SDK files ('facebook.php', 'base_facebook.php', and 'fb_ca_chain_bundle.crt' ) into my application/libraries folder. 2) I've changed the filename of 'facebook.php' to 'Facebook.php'. 3) In my controller, I have the following code: $fb_config = array( 'appId' => 'XXXXXXX', 'secret' => 'XXXXXXX' ); $this->load->library('facebook', $fb_config); $this->load->view('home_view'); But I just get an error and the View does not get loaded. If I comment out the line $this->load

Retrieve Parameter From Page Tab URL

我是研究僧i 提交于 2019-12-06 15:58:17
I have a facebook tab application that has an URL. I want to pass the URL some GET parameters. Normally this is how I do a signed request to get user data: if ($signed_request = parsePageSignedRequest()) { $config = array( 'appId' => $app_id, 'secret' => $app_secret, ); $facebook = new Facebook($config); $ret_obj = $facebook->api('/me', 'GET', array()); $theemail = $ret_obj['email']; $thename = $ret_obj['name']; $theusername = $ret_obj['username']; } I was wondering how to get the GET parameter from the url. The url looks like: https://www.facebook.com/pages/Msomepagey/23023424231927?sk=app

Facebook Graph audience insights queries

半世苍凉 提交于 2019-12-06 15:54:56
I found some intriguing Facebook Graph API documentation here: https://developers.facebook.com/docs/graph-api/reference/audience-insights-query https://developers.facebook.com/docs/graph-api/reference/audience-insights-lifestyle/ https://developers.facebook.com/docs/graph-api/reference/audience-insights-lifestyles/ (plural) https://developers.facebook.com/docs/marketing-api/audience-insights-api/v2.8 I think the results of those queries will be really powerful and could help my business. But all of their examples are unclear and nonfunctional, such as: $request = new FacebookRequest( $session,