How do I get Facebook Application Login to work
Posted
by
Javaaaa
on Stack Overflow
See other posts from Stack Overflow
or by Javaaaa
Published on 2010-12-26T14:16:15Z
Indexed on
2010/12/26
14:54 UTC
Read the original article
Hit count: 225
I just started making an application for Facebook, however I ran into problem early on. The first step I want people to do is to give permission to access their profile. All over the web are examples of how to do this with:
$user_id = $facebook->require_login();
However, this is the way it works using the Old PHP API. I have downloaded and installed the new one in my application folder and it is not working anymore.
My question is (and i really have been searching for an answer for a long time) what is the code to do this with the new API?
(and related question: is it better to use the old API, or learn to work with the new one when I am just starting making apps right now)
I have this code now;
<?php
// Awesome Facebook Application
//
// Name: -
//
require_once 'facebook-php-sdk/src/facebook.php';
// Create our Application instance.
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true
));
$loginUrl = $facebook->getLoginUrl(array(
'req_perms' => 'email,user_birthday,publish_stream,sms,status_update,user_location'
));
echo "<p>hello, <fb:name uid=\"$user_id\" useyou=\"false\" />!</p>";
?>
© Stack Overflow or respective owner