Issue
I have written correct AppID and APP secret but when I am running it on browser, Facebook is saying "The parameter app_id is required"
is there any error in this code, or I have missed some information ? here is the link www.smmstest.base.pk/
<?php
require 'libs/facebook.php';
$facebook = new Facebook(array(
'appID' => '********************',
'secret' => '*************************',
'cookie' => true
));
$user = $facebook->getUser();
if ($user)
{
try
{
$user_profile = $facebook->api("/me");
}
catch (FacebookApiException $e)
{
error_log($e);
$user = null;
}
}
if ($user)
{
$logoutUrl = $facebook->getLogoutUrl();
}
else
{
$loginUrl = $facebook->getLoginUrl();
}
?>
<!doctype>
<html>
<head>
<title>Fan page login</title>
</head>
<body>
<?php if ($user): ?>
<a href="<?php echo $logoutUrl; ?>">Logout</a>
<?php else: ?>
<div>
<a href="<?php echo $statusUrl; ?>">Check the login status</a>
</div>
<div>
<a href="<?php echo $loginUrl; ?>">Login with Facebook</a>
</div>
<?php endif ?>
</body>
</html>
Solution
https://github.com/facebook/facebook-php-sdk
require 'facebook-php-sdk/src/facebook.php';
$facebook = new Facebook(array(
'appId' => 'YOUR_APP_ID',
'secret' => 'YOUR_APP_SECRET',
));
Make sure you use the code from the latest PHP SDK. If you write "appId" correctly, it will add the parameter to every call to the Facebook Servers (which is "app_id" internally).
Answered By - andyrandy
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.