I had hosted two apps a month before but today morning i have noticed that, it was not showing the UserInfo when getuser(); was executed. Just showing 0. Before it was working smoothly. Both apps not working on Web Server. But working fine on Localhost.Please help me out. I even authenticate the user and then takes to other page . Below is my code
require_once 'appinclude.php';
include_once "src/facebook.php";
$facebook = new Facebook(array(
'appId' => $appid,
'secret' => $appsecret,
'cookie' => true,
));
$user = $facebook->getUser();
if($user) {
try {
$me = $facebook->api('/me','GET');
$fname = $me['first_name'];
} catch(FacebookApiException $e) {
error_log($e);
}
} else {
$loginUrl = $facebook->getLoginUrl();
echo("<br>login url=".$loginUrl);
}
Thanks in Advance...
It was firing error Curl Exception 7, unable to connect to Host and which was leadin to this problem.
Go to pico /etc/hosts and enter this line
69.171.224.34 graph.facebook.com
It may help you and also Whitelist IP range listed here http://developers.facebook.com/docs/ApplicationSecurity/#facebook_scraper