facebook-php-sdk

How to avoid fatal error: Uncaught OAuthException when using cron job

纵饮孤独 提交于 2019-12-12 12:03:46
问题 Hi hope somone can help with this one. Ive had a birthday reminder app built, that aquires the usual permissions including offline access etc. The app requires a daily cron job to be run on my server. When I run the cron file a recieve the below error Fatal error: Uncaught OAuthException: Invalid OAuth access token signature. thrown in blah/base_facebook.php on line 1140; Is there a common reason for the error, am i doing anything wrong that stands out, and should i be displaying more code to

Facebook Ads Sdk doesn't allow to post ad via API. Subcode: 1487930

我是研究僧i 提交于 2019-12-12 10:36:37
问题 I've read a lot about facebook ads and stuff, using GUI it allow to do what I'm doing and for some reason on sdk it doesn't. I get this suberror code on Facebook ads sdk subcode 1487930 . The message says: You Must Select an Object to Promote, the user message says: Your campaign must > include an ad set with a selected object to promote related to your objective > > (ex: Page, URL, event). Please update your ad set to continue. Response returns no fields to blame and error happens when

Read Facebook page post and token expiration

自古美人都是妖i 提交于 2019-12-12 10:18:27
问题 I need to read, from a server, the stream of a specific fan page. I tried to read the graph api https://graph.facebook.com//feed?access_token=&limit=100 and it works. What I need is to understand if the token will expire and how to renew it programmatically. Now I generate my token through the http://developers.facebook.com/tools/explorer/ app. Can you please help me? I'm using the PHP sdk thanks, a. 回答1: You can read the facebook page using below codes and you can also get the specified

Facebook Php SDK - getUser() return always 0

自闭症网瘾萝莉.ら 提交于 2019-12-12 10:05:50
问题 I read all threads on this forum but I can't find my solution.. I use the last Php SDK by facebook : v3.2.2 . So I used this: //start fb $facebook = new \Facebook(array( 'appId' => $fb_app_id, 'secret' => $fb_app_secret, 'cookie' => true, )); // get id user-fb $fbUser = $facebook->getUser(); if ($fbUser) { try { $fbUserProfile = $facebook->api('/me'); // take user-infos $friends = $facebook->api('/me/friends'); // take his friend } catch (FacebookApiException $e) { error_log($e); $fbUser =

Getting an Access Token Without User Login in Facebook Graph API?

自古美人都是妖i 提交于 2019-12-12 09:42:19
问题 I am working with facebook graph api rsvp_event. I am using javascript SDK. Everything works great when the user is logged in. But when the user is not logged in, it gives an error. I need information about who is attending a public event. I now understand that I would need an access token to retrieve this information. So, my question is how do I get the access token if no user is logged in? Is it impossible or is there a workaround? Could it be done server side using app_id and client_secret

Facebook PHP SDK $uid = $facebook->getUser() always returns 0 [duplicate]

我是研究僧i 提交于 2019-12-12 09:06:15
问题 This question already has answers here : Why is Facebook PHP SDK getUser always returning 0? (26 answers) Closed 5 years ago . I am trying to integrate our DB with the facebook API , really new on this so I would appreciate some help. I am always getting 0 Using $uid = $facebook->getUser() I had a look to similar issues but didn't find a related solution. PHP if($_REQUEST['action']=="signup" && $_REQUEST['auth']=="facebook" && !empty ($_REQUEST['auth']) && !empty ($_REQUEST['action']) ) {

Facebook API works fine for /feed, but not for /photos

自闭症网瘾萝莉.ら 提交于 2019-12-12 09:00:08
问题 Following is the code that works fine if I am passing /pageid/feed to facebook->api , but when I change it to upload the image directly to my Facebook photo album, it will not work. Kindly let me know what I am doing wrong in the following code: // Works fine $status = $facebook->api("/194458563914948/feed", 'post', $attachment); // Does not work $status = $facebook->api("/196878530339618/photos", 'post', $attachment); Full Source <?php require 'src/facebook.php'; $app_id = "332267477347";

Retrieve facebook user id from the username

对着背影说爱祢 提交于 2019-12-12 07:05:12
问题 I want to retrieve a Facebook user id if I have his username. This was deprecated from the graph API but I would like to know a work around on getting the id if i have the username. There is a website that does that but I am not sure how they do it. 回答1: I did the R&D and found that the given website is not using the API to fetch userid from the username. They are using another mechanism which is not valid. I have found 1 mechanism to find the userid from the username. Below is the c# code

Check if a facebook user can post in his friends wall or not

孤街醉人 提交于 2019-12-12 05:00:59
问题 As far as I've done research I could come up with use of can_post in fql query. Now how can I find out can_post value of the user. I'm using php-sdk and have taken the permission to post to friend's wall but since if friend has disabled posting on his wall it would return an exception which would make the script stop. So, if I could use this can_post value to check if he can post before posting. 回答1: You could get the can_post field using fql and that will return either true or false. So if

Facebook auth dialog doesn't show up in page tab

三世轮回 提交于 2019-12-12 04:47:10
问题 The Facebook Auth Dialog won't show up when viewing the app in a page tab (iframe). It works fine when viewing the app externaly though. My Facebook app settings are: Site URL: http://domain.com/test Canvas URL: http://domain.com/test/ Secure Canvas URL: https://domain.com/test/ Page Tab URL: http://domain.com/test/ Secure Page Tab URL: https://domain.com/test/ I've added the app to the page tab ny using the link: https://www.facebook.com/dialog/pagetab?app_id=[MY_APP_ID]&next=https://domain