facebook-php-sdk

Get list of Page Albums using Facebook PHP SDK v5

我的未来我决定 提交于 2019-12-09 00:01:20
问题 I want to use Facebook PHP SDK v5 to get a list of photo albums for a Page. I am following the instructions at https://developers.facebook.com/docs/graph-api/reference/v2.4/page/albums, which are as follows: /* PHP SDK v5.0.0 */ /* make the API call */ $request = new FacebookRequest( $session, 'GET', '/{page-id}/albums' ); $response = $request->execute(); $graphObject = $response->getGraphObject(); /* handle the result */ This does however seem to be incorrect as there is no " execute "

How to check if someone shared my page's post? Using Facebook API

半城伤御伤魂 提交于 2019-12-08 19:53:32
I have the read_stream access from user, I want to award him some points if he shares one of my pages' post. Now I have Claim Point button so I can crawl his posts, and I want to check if he has shared my page's post (using Share link of Facebook, near Comment and Like ). I had an Idea, if someone shares others' post it appears as a link, so I tried to match the link with my page's link, but if its a Facebook link (or post like status, note) then url form below FQL returns null . Same happens with Graph API (link doesn't appear). select url,link_id,title from link where owner=me() It works

How to add newlines or carriage returns to description on facebook graph API

久未见 提交于 2019-12-08 18:56:26
问题 It sounds like a pretty simple question but I can find the answer no where. I have a post from a textarea. and I want to use the current facebook php library to do the following... $description = $_POST['textarea_description']; //magic happens $attachment = array( 'access_token' => $token, 'message' => "$title", 'picture' => "$image_url", 'link' => "$action_link", 'name' => "$action_label", 'caption' => "$caption", 'actions' => $action_json, 'description' => "$description", ); $facebook->api(

Facebook->api(“/me”) raises “CurlException: 3: No URL set!”

时光毁灭记忆、已成空白 提交于 2019-12-08 18:09:32
I have an iframe page tab facebook app that, for some users on some pages, raises a "CurlException: 3: No URL set!" exception when calling $facebook->api("/me"). Here is the code : $config = array(); $config['appId'] = APPID; $config['secret'] = APPSECRET; $config['cookie'] = true; $config['fileUpload'] = false; // optional $facebook = new Facebook($config); $facebook->setExtendedAccessToken(); $access_token = $facebook->getAccessToken(); if (isset($_GET['tk'])&&($_GET['tk']!="")){ $_SESSION['appat'] = $_GET['tk']; } if ($_SESSION['appat']!="") $access_token = $_SESSION['appat']; $facebook-

Fatal error: Uncaught CurlException: 7: couldn't connect to host thrown in …src/base_facebook.php on line 887

杀马特。学长 韩版系。学妹 提交于 2019-12-08 15:55:21
问题 I'm trying to develop a sample facebook php login example following the example here I've hosted my app here, but I'm getting the error message in the question whenever I try to access the link. Here's the code segment that throws the error try { $e = new FacebookApiException(array(// LINE 887 'error_code' => curl_errno($ch), 'error' => array( 'message' => curl_error($ch), 'type' => 'CurlException', ), )); curl_close($ch); } // edit suggested by Kneel-before ZOD catch(FacebookApiException $e)

Facebook Error (#200) The user hasn't authorized the application to perform this action (PHP)

廉价感情. 提交于 2019-12-08 15:44:33
I am posting on facebook profile, pages and groups using my webapp.since morning it showing error "Exception occured, code: 200 with message: (#200) The user hasn't authorized the application to perform this action". I added all permissions required for posting. $loginUrl = $helper->getLoginUrl( ["public_profile", "user_groups","publish_actions","email","user_location","user_photos", "user_likes","manage_pages","user_birthday","user_status","read_stream"] ); $requestPage = new FacebookRequest($session, 'GET', 'post_on_page_id?fields=access_token'); $responsePage = $requestPage->execute();

PHP - Get post data from Facebook page using only facebook graph

不想你离开。 提交于 2019-12-08 13:48:46
问题 is there a way to get Facebook page the contents of an post using simple php . i need to do that without The Php-sdk or the Facebook API only using the Facebook Graph and Facebook app 回答1: I have found the solution <?php error_reporting(0); /*xxxxclient_idxxx='your clientid'*/ /*xxxxxxclient_secretxxxx='your client_secret'*/ //Replace "YOUR-PAGE-NAME" with your page name. $access_str = file_get_contents('https://graph.facebook.com/oauth/access_token?client_id=xxxxclient_idxxx&client_secret

Facebook PHP SDK & Page feed post (filtering results)

不想你离开。 提交于 2019-12-08 13:02:39
问题 Facebook PHP SDK & Page feed post (filtering results) Greetings! I've been working lately on an effective way to implement a Facebook public page feed (each post featuring description, date and picture) on a website. I've put put together the following code wich allows me to use a foreach on $elements. $pageid = '#PAGEID#'; $accesstoken = '#ACCESSTOKEN#'; $url = "https://graph.facebook.com/v2.7/$pageid/feed?limit=20&access_token=$accesstoken"; function getfb($url){ $curl = curl_init(); curl

Get Facebook user profile data in php

别来无恙 提交于 2019-12-08 11:56:25
问题 The following code should return the email address of the user logged in. <?php require_once('facebook-php-sdk/src/facebook.php'); // Create our Application instance (replace this with your appId and secret). $facebook= new Facebook(array( 'appId' => '2453463636', 'secret' => '365653656565656', 'allowSignedRequest' => false, )); $user = $facebook->getUser(); print_r($user); if ($user) { try { // Get the user profile data you have permission to view // $user_profile = $facebook->api('/me');

How can long-lived access token be retrieved for a page via graph explorer?

試著忘記壹切 提交于 2019-12-08 11:54:00
问题 I want to allow an app to post as a page, so I used graph api to get access token to the page but it has one hour expiry. Is there a way to retrieve long term access tokens via graph api? P.S. I tried to use the endpoint for exchanging the short term access token with long term one and am getting OAuth error. 回答1: You can have a never expiring token for your fan page. Follow the simple steps: Get the admin's(i.e. yours) extended token (2 months validity). Go though the link to get the