facebook-php-sdk

PHP facebook SDK 4.0 login error

 ̄綄美尐妖づ 提交于 2019-12-04 06:13:33
问题 I was looking for docs on official page but there is no anything helpful, so i build this code and it don't work. FacebookSession::setDefaultApplication('app-id', 'app-secret'); $helper = new \Facebook\FacebookRedirectLoginHelper('http://my-return-url'); if (isset($_SESSION['token'])) { $session = new FacebookSession($_SESSION['token']); if (!$session->validate()) { $session = null; } } else { try { $session = $helper->getSessionFromRedirect(); } catch(FacebookRequestException $ex) { die(

JS SDK vs. PHP SDK

佐手、 提交于 2019-12-04 05:20:37
From my brief exploration around various websites, it seems that the JS SDK is much more commonly used than the PHP SDK. Even sites that are implemented in PHP use the JS SDK. The PHP reference page has 776 likes, whereas the JS reference page has 20k+ likes. The PHP reference page says the PHP SDK helps you add Facebook Login to your page, but even the Login Button uses the JS SDK. Does the PHP SDK actually have any advantage at all? Why so little effort is being put into the PHP SDK? Well, the JS SDK is bound to be more popular. Not everyone develops their server side code in PHP, (could be

Extending Access Token Expiration not functioning

那年仲夏 提交于 2019-12-04 04:21:15
问题 I am at the intermediate level in php and am new with facebook development. I have looked through the facebook documents and Stack Overflow previous comments. All I basically wanted to do was let the user log in with their Facebook account and display their name. My php page has a graph, and the page auto refreshes every 2 or 5 min. I authenticate and get the facebook first_name to put on the page. $graph = $facebook->api('/me'); echo $graph['first_name'] to get the first name of the user ..

Post to facebook via cron

点点圈 提交于 2019-12-04 04:03:57
I've been trying for two days to post messages gathered from a twitter search to one of my facebook pages automatically - i.e. via a cronjob. The twitter part went fine, but for the life of me i can't get the Facebook part to work. The problem is that my script works... until it doesn't, usually the access_token is expired after a few hours. Now i have this message : #200) Posts where the actor is a page cannot also include a target_id . I've tried many things suggested on various SO threads. Problem is: the Facebook API seems to change quite often and what used to work doesn't. Any idea and

Cookies not setting in Safari 6

和自甴很熟 提交于 2019-12-04 03:53:07
Good evening, I've asked this question a couple of times without responses, hope this time goes well. I've been developing facebook apps for a couple of years now, using php and the Facebook PHP SDK. Lately I've been struggling with Safari and the login with Facebook. The problem is that Safari 6 has checked by default the "Block 3rd party cookies" option, so my app can't set the cookies automatically. I'm seeing this only in Safari, the cookies are empty, unlike Chrome or Firefox, both are saving cookies well. I'm logging in the user with the Facebook PHP SDK example , so I don't know where

Facebook PHP SDK Throwing an Uncatchable OAuthException

风流意气都作罢 提交于 2019-12-04 01:24:15
问题 I'm attempting to post an open graph action to the Facebook Graph API but receiving an OAuth Exception (#3501) User is already associated to the <object> . That's all well and good, I expect Facebook to throw that exception. I get some other exceptions regarding authenticating a user (maybe with old/stale sessions, whatever). My question is, has anyone else experienced that this exception is uncatchable in php? In this specific example (of posting graph actions) I am absolutely wrapping the

How to do batch request of fql queries in graph api?

半世苍凉 提交于 2019-12-03 21:55:09
I am having 4-5 fql queries in single function. Each of them taking 2-4 seconds to execute. Total 14-15 seconds are required to execute that whole function. User required to wait for long time. So I want to reduce that processing time. ( There is not well supported multi-threading concept in PHP.) I have heard of batch request concept in graph api. And I have googled a lot but didn't understand how to use batch request for fql queries in graph api. Can anyone give explanation with example for using batch request of fql queries ? By what time query processing time will reduce? Is there any

Cannot access Facebook signed_request with an iframe tab

拈花ヽ惹草 提交于 2019-12-03 21:19:51
I've got an iframe loading in a facebook tab on a fan page and I'm not having any luck accessing the $_REQUEST["signed_request"] object. I'm confused because this is supposed to be a freebie and easily accessible. I've read and re-read the facebook docs and rechecked my facebook application settings but nothing is working. isset($_REQUEST['signed_request'] is always false. Since I'm using the Facebook PHP sdk I've also tried $facebook->getSignedRequest(); I've done print_r on the $_REQUEST and I don't see the signed_request in there. When I print_f the $facebook object, I see that the

Using FQL to retrieve only upcoming birthdays from Facebook API

回眸只為那壹抹淺笑 提交于 2019-12-03 20:47:30
Using the information on FQL and the user table from Facebook's Developer's docs, I've come up with the following code. //build fql string $fql = "SELECT name, birthday_date FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND strlen(birthday_date) != 0 AND substr(birthday_date,0,3) IN ('{$currentMonth}/', '{$nextMonth}/')"; $fql.=$orderBy; $fql.=" LIMIT " . $limit; //query facebook $params = array( 'method' => 'fql.query', 'query' => $fql, 'callback' => '' ); $birthdays = $this->facebook_obj->api($params); $currentMonth and $nextMonth are set to string representations of the

CURL Get Request with a parameter that contains a GET url

橙三吉。 提交于 2019-12-03 20:38:32
问题 I'm trying to make a cURL GET to scrape a Facebook Graph object: GET https://graph.facebook.com/?id=**OBJECT_URL**&scrape=true&method=post In my case, OBJECT_URL contains GET parameters: https://www.example.com/og.php?a=b&c=d For that reason I can't have it as a GET parameter in file_get_contents() or CURLOPT_URL , as it'd turn out something like this: https://graph.facebook.com/?id=**https://www.example.com/og.php?a=b&c=d**&scrape=true&method=post Is there a way to pass it as a GET parameter