I am new to the facebook api. I had written the following code after reading the fb developers documentation:
<?php
require_once("php-sdk/src/facebook.php");
$config = array();
$config[‘appId’] = '(my app id)'; //correct in actual code
$config[‘secret’] = '(my app secret)'; //correct in actual code
$config[‘fileUpload’] = false; // optional
$facebook = new Facebook($config);
$user=$facebook->getUser();
if($user==0)
{
$params = array(
'redirect_uri' => 'http://mydomain.com/facebook/php_index.php'
);
$login_url = $facebook->getLoginUrl($params);
echo $login_url."<br/><br/>";
echo '<div class="notice">You need to <a href="' . $login_url . '" onclick="top.location.href = \'' . $login_url . '\';">authenticate first</a>.</div>';
}
else
{
echo $user;
}
?>
The domain & url seetings are correct in fb apps page. But still on clicking the login link it shows An error occurred. Please try later.
Can somebody please help me out. thanks in advance.