facebook-php-sdk

post a feed on my facebook application fan page

空扰寡人 提交于 2019-12-06 13:01:07
问题 I know how to post something on my wall $facebook->api('/me/feed/', 'post', $feed); but how to post feed on my facebook application page and this feed must be posted by the app 回答1: Here you go: // we need to get an application access_token first $token_url = "https://graph.facebook.com/oauth/access_token?" . "client_id=" . $app_id . "&client_secret=" . $app_secret . "&grant_type=client_credentials"; $app_token = file_get_contents($token_url); // seperate the string returned to use it in the

How to publish Actions to Facebook Graph API with parameters in call URL

那年仲夏 提交于 2019-12-06 12:41:52
问题 To begin, Ive spent several hours looking for an answer and have come CLOSE but havent found a full answer. So Im trying to publish actions using Facebook's Graph API and want to send parameters in the URL when initially calling it with the Facebook Javascript SDK. Here is a call that WORKS: function postNewAction() { passString = '&object=http://mysite.com/appnamespace/object.php'; FB.api('/me/APP_NAMESPACE:ACTION' + passString,'post', function(response) { if (!response || response.error) {

post to the fan page's wall as page from another PHP site

霸气de小男生 提交于 2019-12-06 12:04:53
问题 I know that there are lot's of questons on this, but all seem to be needing a user to be logged in... I have been using code snippets from all possible tutorials, but none seem to work. Here is the scenario: I have a photo community running on PHP and I have a fan page on Facebook. When an image on the main site collects a certain amount of votes a function is triggered to post the image link to the Facebook wall. The link (post) is posted as a page and not as admin. Admin of course will not

Extending 60 days Facebook token

不打扰是莪最后的温柔 提交于 2019-12-06 11:46:07
问题 I'm using Hybridauth to connect with Facebook. Everything works well at that point ;-) I get a token and when I check it at https://developers.facebook.com/tools/debug/ I see it has 2 months expiration. After some days, for example, 50 days, I see the token will expire in 10 days indeed. I try to extend with method documented (and described in other StackOverflow questions) with: https://graph.facebook.com/oauth/access_token? client_id=APP_ID& client_secret=APP_SECRET& grant_type=fb_exchange

Getting friends list using facebook api's

送分小仙女□ 提交于 2019-12-06 11:03:54
问题 I have the following command which will allow me to post a message on the logged in users facebook wall: $facebook->api("/$uid/feed", "POST", array('message' => 'Hello! I\'m using the FB Graph API!')); i.e. using the url https://graph.facebook.com/<user id goes here>/feed But what command do I need to enter to get a list of the logged in users friends? The url I need to use is https://graph.facebook.com/me/friends , but I am not sure how to edit the below command to get the friends list:

Upload image to Facebook Wall / Feed via Graph API

回眸只為那壹抹淺笑 提交于 2019-12-06 09:56:43
问题 I am trying to upload local images directly to a pages feed (i.e. "Wall Photos" album). This is the code that I think should work: <?php $facebook = new Facebook(array( 'appId' => $the_app_id, 'secret' => $this_app_secret, )); $facebook->setAccessToken($the_access_token); $facebook->setFileUploadSupport(true); $attachment = array( 'message' => $the_post_body, 'name' => $this_image_name, 'picture' => '@' . $the_absolute_path_to_image ); $result = $facebook->api('/me/feed, 'post', $attachment);

Facebook login not redirecting [closed]

♀尐吖头ヾ 提交于 2019-12-06 09:21:45
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center . Closed 6 years ago . Why is the following not working? // Login or logout url will be needed depending on current user state. if ($user) { $logoutUrl = $facebook->getLogoutUrl(); } else { $loginUrl = $facebook->getLoginUrl(); header("Location: ".$login_url); } Using xdebug, I

Facebook PHP-SDK seems to lose userID after page refresh

半腔热情 提交于 2019-12-06 06:32:53
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(array( 'appId' => 'APP_ID', 'secret'=> 'APP_SECRET', 'cookie'=> 'true' )); $userId = $facebook-

Facebook PHP SDK - Getting error when posting to facebook page but post is created

北城余情 提交于 2019-12-06 06:10:34
I don't know why but I get the following error when I'm trying to post to a facebook page that I've created: Fatal error: Uncaught exception 'Facebook\FacebookAuthorizationException' with message 'Unsupported post request. Here's the code that I currently have: <?php session_start(); require 'vendor/autoload.php'; use Facebook\FacebookSession; use Facebook\FacebookRedirectLoginHelper; use Facebook\FacebookRequest; use Facebook\FacebookResponse; use Facebook\FacebookSDKException; use Facebook\FacebookRequestException; use Facebook\FacebookAuthorizationException; use Facebook\GraphObject; use

How to Read/ Parse Data of Signed_Request from Registration Script in Php 5.1.6

China☆狼群 提交于 2019-12-06 05:13:11
I'm trying to implement the Facebook registration script. The form is getting submitted fine and the server is receiving the signed request. However, it is not able to read/parse the signed request. I used the script recommended on the registration page https://developers.facebook.com/docs/plugins/registration/ (code below) and all I see for output is: signed_request contents: I have verified that the signed_Request is being received. If I pass it to: http://developers.facebook.com/tools/echo?signed_request= I see data. However on my server with the script below nothing. The server is http NOT