facebook-php-sdk

Retrieve Facebook Insights for all active ads within an account?

我只是一个虾纸丫 提交于 2019-12-12 03:56:00
问题 My code allows me to retrieve all ads that between certain dates, but this includes ads that are no longer active. I want to show insights only for ACTIVE ads. How can I retrieve Facebook Insights for all active ads within an account? public function getInsights($levelType, $id, $aggLevel, $start, $end) { if ($levelType) { if ($id == null) { abort(400, 'You must provide the ID for the object you want to retrieve.'); } } else { $levelType = \AdAccount::class; $id = ACT_PREPEND . $this-

Subscribe Facebook page to external app

假如想象 提交于 2019-12-12 03:48:14
问题 I have a webapplication where brands have a feed and can post things. I want to make them be able to, whenever they post something on their Facebook page, it becomes posted in the feed of my webapp. I know I have to use the webhooks and all that. So far, I have tried this: I have created my own app in Facebook. I created a Facebook page (with that same account). I created the webhook. I added my app to my page's subscribed apps. I post something on my page, and it works. Now, let's say there

Get list of top friends for facebook app

只谈情不闲聊 提交于 2019-12-12 03:11:47
问题 I am Creating A facebook that Retrieves 10 Random friends.But I need some code to Retrieve Top friends using comment and like ativity.I used Following code but i get below error Invalid argument supplied for foreach() below is the code i tried so far. $statuses = $facebook->api('/me/statuses'); foreach($statuses['data'] as $status){ // processing likes array for calculating fanbase. foreach($status['likes']['data'] as $likesData){ $frid = $likesData['id']; $frname = $likesData['name'];

FB Graph API: Mutual Friends returns empty array

a 夏天 提交于 2019-12-12 03:03:33
问题 I am having an FB app and I want to find mutual friends between 2 users using my app. When I use Graph Explorer for my app to find the mutual friends between 2 users connected to my app, it returns the correct results. However, when I run the same query on my facebook php sdk, I get empty results. This is my code: $fb_app_id = $this->config->item('facebook_app_id'); $fb_secret = $this->config->item('facebook_secret'); $facebook = new Facebook(array( 'appId' => "$fb_app_id", 'secret' => "$fb

How to get all post from a page with count ALL likes and comments?

谁说胖子不能爱 提交于 2019-12-12 02:34:52
问题 attached got a question ... I try with all feeds Likes and Comments retrieve a page during a period. or .. actually I only need the total number of likes and comments overall. So far ... $user_pages = $facebook-> api ('/ me / accounts'); ... $page_feeds = $facebook-> api ("/". $ page_name ['id']. '/ feed', 'GET', array ('limit' => 10000, 'since' => mktime (0,0, 0, date ("m"), 1, date ("Y")))); ... foreach ($page_feeds ['data'] as $ page) { $c = $facebook-> api ("/" $ page ['id'] "/ likes",

PHP for an image gallery pulled from facebook, only grabs the first 25 images

旧街凉风 提交于 2019-12-12 02:19:11
问题 Sorry if this seems like a dumb question, but I am realizing I have a LOT to learn about PHP. I was wondering what am I skipping, because as the title says, my image gallery using PHP takes images from a facebook site, but only pulls the first 25 pictures everytime, and all the pictures are public and uploaded by the same person. I am using a tutorial taken from this site: http://www.webdesignermag.co.uk/tutorials/facebook-image-gallery/ And the code used specifically is this: <?php //Set the

Application with ID has not been granted the capability to use the property message

北战南征 提交于 2019-12-12 02:12:44
问题 I am trying to post custom fb objects on my wall using php facebook sdk and facebook graph api. And i am getting this error. I tried, but could not find specific answer about that. Even is not mentioned on Facebook Itself. Is there anyone can help me to get this issue resolve. 回答1: You are talking about publishing an Open Graph action, I suppose? See https://developers.facebook.com/docs/opengraph/actions/#create: Optional Parameters Requiring Review You must request these optional properties

Do I need to use access token in Facebook API?

若如初见. 提交于 2019-12-12 02:04:29
问题 From what I understand if I need to make request to facebook API I need to pass access token with it. However, I just had a look at the Facebook official example - they did not provide include access token to make request? $user_profile = $facebook->api('/me'); Where and When do I need to use access token for? 回答1: The example you've provided is using the PHP-SDK. It automatically appends an access_token as required. You only need to worry about tokens in the context of permissions, depending

FB API Cookie Header Error

你。 提交于 2019-12-12 01:59:52
问题 I have the following code: require '../lib/facebook-php-sdk/src/facebook.php'; $facebook = new Facebook(array( 'appId' => '143944345745133', 'secret' => 'xxxxxxxx', 'cookie' => true, )); $user = $facebook->getUser(); if ($user) { try { $user_profile = $facebook->api('/me'); } catch (FacebookApiException $e) { $user = 0; } } if ($user) { setcookie('loggedUserId', $user, time()+36000); setcookie('loggedUserName', $user_profile['name'], time()+36000); } else { setcookie('loggedUserId', '', time(

Automatic Login Facebook PHP SDK

瘦欲@ 提交于 2019-12-12 01:45:40
问题 I want something like this: When the user has been logged in to Facebook, so when they go to my website, they do not need to make a log in process again. I want to catch the login data automatically like SoundCloud.com did. Anyone knows how to make this work? Thanks 回答1: Lets say your login page is login.php then at the bottom of the page add an div element with the id id="fb-root" and just close that div. Below that add the following JS window.fbAsyncInit = function() { FB.init ({ appId :