I had a working site using facebook api version 2.0 but was having some problems. I realized some of my calls were depreciated and so I set up composer and included the facebook api.
I think my problem is how I am including the api in my site.
I was using require 'facebookAPI/src/facebook.php';
Now that I am using composer
this does not work.
file path is, vendor/facebook/php-sdk-v4/src/Facebook/ There is no facebook.php file in here.
How do I add the api? If facebook.php does not exist anymore? Do I use different files to achieve different goals? And last.. Can I use the autoloader by
require 'vendor/autoload.php';
If is there anything else i'm supposed to do from there?
Here is my full current code that just shows a blank page when the page loads.
<?php
require 'vendor/autoload.php';
$facebook = new Facebook(array(
'appId' => 'foo foo foo',
'secret' => 'foo foo foo',
));
$user = $facebook->getUser();
if ($user) {
try {
$user_info = $facebook->api('/' . $user);
$user_tags = $facebook->api('/' . $user . '/tagged_places');
$friends = $facebook->api('/' . $user . '/friends');
$user_feed = $facebook->api('/' . $user . '/feed/?with=location');
$friends_locations = $facebook->api('/' . $user . '/friends/?fields=location');
$user_checkins = $facebook->api('/' . $user . '/checkins');
$friends_checkins = $facebook->api('/' . $user . '/friends/checkins');
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
if ($user) {
$params = array( 'next' => 'http://www.wuno.com/sandbox/actions/fbLogout.php' );
$logoutUrl = $facebook->getLogoutUrl($params);
} else {
$loginUrl = $facebook->getLoginUrl(array(
'scope' => 'user_tagged_places, email, publish_actions, publish_stream, user_birthday, user_work_history, user_hometown, user_photos, user_about_me, user_checkins, friends_checkins, user_location, friends_location, read_stream, user_status, friends_status')
);
}
?>