I have two websites, in the same server, and the facebook API 3.2.3 (PHP) is not working anymore. It was working last night but it isnt now.
When I try to login in one of the sites it shows:
Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://graph.facebook.com:443 (connection time-out)
the other one:
CurlException: 7: couldn't connect to host
So,
I tried to change one of them from server: the error continues. I tried to create a new app and try a different APP ID: the error continues. I used the example code from Facebook API Page: The error continues require 'facebook/src/facebook.php';
require 'facebook/src/facebook.php';
$config = array(
'appId' => 'MY APP ID',
'secret' => 'MY APP SECRET',
'allowSignedRequest' => false // optional but should be set to false for non-canvas apps
);
$facebook = new Facebook($config);
$user_id = $facebook->getUser();
?>
<html>
<head></head>
<body>
<?php
if($user_id) {
// We have a user ID, so probably a logged in user.
// If not, we'll get an exception, which we handle below.
try {
$user_profile = $facebook->api('/me','GET');
echo "Name: " . $user_profile['name'];
} catch(FacebookApiException $e) {
// If the user is logged out, you can have a
// user ID even though the access token is invalid.
// In this case, we'll get an exception, so we'll
// just ask the user to login again here.
$login_url = $facebook->getLoginUrl();
echo 'Please <a href="' . $login_url . '">login.</a>';
error_log($e->getType());
error_log($e->getMessage());
}
} else {
// No user, print a link for the user to login
$login_url = $facebook->getLoginUrl();
echo 'Please <a href="' . $login_url . '">login.</a>';
}
?>
I dont know what is happening.