मैं वर्तमान में अपने वेब पेज के लिए फेसबुक कनेक्ट लॉगिन पेज पर काम कर रहा हूं।घातक त्रुटि का समाधान: फेसबुक प्रमाणीकरण के दौरान अपरिभाषित विधि फेसबुक :: getSession() पर कॉल करें
लेकिन मैं लाइन 24 पर 'अपरिभाषित विधि करने के लिए कॉल' त्रुटि संदेश प्राप्त करते रहने:
$session = $facebook->getSession();
जब मैं लाइन को हटाने के 24 सब कुछ सुचारू रूप से चलाने के लिए लगता है।
क्योंकि मैं http://www.9lessons.info/2011/01/facebook-graph-api-connect-with-php-and.html और http://net.tutsplus.com/tutorials/php/how-to-authenticate-your-users-with-facebook-connect/ पर एक ट्यूटोरियल का अनुसरण कर रहा हूं - इस तरह ने मुझे स्टंप किया!
त्रुटि संदेश
Fatal error: Call to undefined method Facebook::getSession() in C:\xampp\htdocs\kite\index.php on line 24
कृपया मदद है। अग्रिम में बहुत धन्यवाद। यहां मेरा कोड है:
<?php session_start();
//config
include "resources/Connections/kite.php";
//connect to the database so we can check, edit, or insert data to our users table
$con = mysql_connect($hostname_kite, $username_kite, $password_kite) or die(mysql_error());
$db = mysql_select_db($database_kite, $con) or die(mysql_error());
//include out functions file giving us access to the protect() function made earlier
include "resources/php/functions.php";
//setup facebook connect
require 'resources/facebook/src/facebook.php';
$facebook = new Facebook(array(
'appId' => $appid_kite,
'secret' => $secret_kite,
));
// Get User ID
$user = $facebook->getUser();
// Let's see if we have an active session
$session = $facebook->getSession();
// We may or may not have this data based on whether the user is logged in.
//
// If we have a $user id here, it means we know the user is logged into
// Facebook, but we don't know if the access token is valid. An access
// token is invalid if the user logged out of Facebook.
if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}// Login or logout url will be needed depending on current user state.
if ($user) {
$logoutUrl = $facebook->getLogoutUrl();
} else {
$loginUrl = $facebook->getLoginUrl();
}
ob_start();
?>
नीचे देखें। एपीआई का नवीनतम संस्करण विभिन्न कार्यों का उपयोग करता है। – RevNoah