facebook-php-sdk

how to use graph api access token in php for facebook sdk

六月ゝ 毕业季﹏ 提交于 2019-12-12 01:34:42
问题 I'm really stuck on this matter. I've been reading the documentation over and over and I don't understand how to use the access token for my page, so that I could pull the page's messages. This is my code: $user_id = $facebook->getUser(); if($user_id) { $user_profile = $facebook->api('/me/accounts', 'GET'); } and then I get an array, with two keys: data and paging Inside of data I get an array of the pages I own, where the access_token is available for each page. According to this page: https

Posting a link to a page not showing up?

我与影子孤独终老i 提交于 2019-12-12 01:20:04
问题 <?php $appId = 'XXXXX'; $pageId = 'XXXXX'; $secret = 'XXXXX'; $token = 'XXXXX'; $data = array( 'access_token' => $token, 'description' => 'test_description', 'link' => 'http://www.google.co.uk', 'message' => 'test_message', 'name' => 'test_name' ); try { require_once 'facebook/facebook.php'; $sdk = new Facebook( array( 'appId' => $appId, 'secret' => $secret, 'cookie' => true ) ); $post = $sdk->api('/'.$pageId.'/feed', 'POST', $data); print_r($post); } catch (FacebookApiException $e) { echo $e

How can I tag friends in uploaded photo using facebook php SDK

断了今生、忘了曾经 提交于 2019-12-11 20:38:51
问题 I'm doing this to create an album and upload a photo to user's profile: $facebook->setFileUploadSupport(true); $args = array('message' => $statusFinal); $args['image'] = '@' . realpath($imagePath); $data = $facebook->api('/me/photos', 'post', $args); Is it possible to tag user friends? How can I do this? 回答1: Yes, it is possible and described in documentation 来源: https://stackoverflow.com/questions/10166292/how-can-i-tag-friends-in-uploaded-photo-using-facebook-php-sdk

Facebook Page Access Token can be used to post stuff?

混江龙づ霸主 提交于 2019-12-11 19:48:29
问题 I have read some introduction about Facebook's access token on http://www.devils-heaven.com/facebook-access-tokens/ What I want to ask is that can the page access token of Facebook be used as a permanent token if I just want to post something on the wall like user access token? 回答1: First of all don't ever follow the third-party documentation for the facebook integration. They have the official documentation pls follow that. For access tokens read here. What I want to ask is that can the page

Does PHP or PHPUnit or Laravel have a function for recursive array comparison?

房东的猫 提交于 2019-12-11 19:12:43
问题 Some of my PHPUnit tests call the Facebook "php-business-sdk" so that I can be confident that Facebook's API is continuing to operate as I expect. E.g. getInsights() within FacebookAds\Object\Ad . And those PHPUnit tests have been using assertEqualsCanonicalizing . However, the tests are still brittle; Facebook's API often changes not just the order of the top-level array in the result (an array of associative arrays) but also the order of the keys inside the associative arrays. So what I

Automatic Login with Facebook PHP SDK doesn't works

天大地大妈咪最大 提交于 2019-12-11 18:09:44
问题 I integrated facebook with my site using Facebook PHP SDK, I have logged into my facebook account, but when I enter into my website, automatic login doesn't happens ? $facebook = new Facebook(array( 'appId' => XXXXXX, 'secret' => XXXXXXXXXXXXXX, )); $user = $facebook->getUser(); // Login or logout url will be needed depending on current user state. if ($user) { $logoutUrl = $facebook->getLogoutUrl(); } else { $loginUrl = $facebook->getLoginUrl(); } Here $user value is '0', while entering to

Facebook development - login url

不羁岁月 提交于 2019-12-11 17:44:24
问题 I'm building facebook app. I need to get some permissions. I use php sdk. Everything works fine, but the problem is that LOGIN URL opens in popup mode and some browsers doesn't allow that action. Can you tell what can I do in this case? <?php require 'src/facebook.php'; $config = array( 'appId' => '123456789', 'secret' => '123456789', 'fileUpload' => true, 'allowSignedRequest' => false ); $facebook = new Facebook($config); $user_id = $facebook->getUser(); if($user_id) { try { include "some

Get more than 100 data from Facebook Graph API

╄→尐↘猪︶ㄣ 提交于 2019-12-11 16:54:53
问题 I use this function when I get user page likes from Facebook Graph API. Before 2 months ago this function is working and get more than 100 data from Facebook. but now this function get only lower than 100 page likes for every user . Facebook API has a next section and normally this function is working good. How can I resolve this problem? Facebook API example below the code. I need to go next page of the api but I can't. public function handle() { $fb = new Facebook([ 'app_id' => 'xxxxxx',

How to make a user subscribe to another users using Graph API?

蹲街弑〆低调 提交于 2019-12-11 15:38:29
问题 I would like to users when added to this website they automatically subscribe to another users in facebook. I know I can list users, which the authenticated user is subscribed to, but can I make a new subscription? thanks. 回答1: Looking at docs, http://developers.facebook.com/docs/reference/api/user/#subscribedto Graph api gives only 'read' action for both subscribers and subscribedto However, you can use the Subscribe Button plugin 来源: https://stackoverflow.com/questions/10568909/how-to-make

Convert Facebook Fanpage ID to Fanpage Name PHP SDK

给你一囗甜甜゛ 提交于 2019-12-11 15:04:34
问题 Well, I really have no idea how to do this, all I see in some posts here is like use this and you will get fan page id thing. $signedrequest = $facebook->getSignedRequest(); And so on.. But my problem lies in here, I'm trying to do a mysql select query, for example //Note that $uid is MY user id $query = "SELECT fanpage_id FROM fb_table WHERE uid='".$uid."'; $result = mysql_query($query); $fanpage_id = $result[0]; So if I echo the fan page id, it will output like this 420276361382765 How do I