[英]Facebook getuser return 500 internal error in PHP SDK
I have this type of problem i use the PHP SDK latest version , and from march my application is stopped when i must done the login. 我遇到这种类型的问题,我使用最新版本的PHP SDK,并且从3月开始,当我必须完成登录时,我的应用程序停止了。 I have done the upload of the latest version but now when php execute 我已经上传了最新版本,但是现在当php执行时
$user = $facebook->getUser();
I obtain error 500 internal etc. etc. . 我收到错误500内部等。 I have tried everythings, but now i don't know what's the problem, i have also tried with Facebook PHP SDK 500 - Internal server error 我已经尝试了所有方法,但是现在我不知道出了什么问题,我也尝试了使用Facebook PHP SDK 500-内部服务器错误
but i obtain only internal error. 但我只获得内部错误。 If someone can help me. 如果有人可以帮助我。 The Code is this 代码是这个
<?php
require 'src/facebook.php';
$facebook = new Facebook(array(
'appId' => 'fdsafdasfdasfdsafas8',
'secret' => 'dasgasgasgasgas',
));
// See if there is a user from a cookie
$user = $facebook->getUser();
if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
echo '<pre>'.htmlspecialchars(print_r($e, true)).'</pre>';
$user = null;
}
}
?>
<!DOCTYPE html>
<html xmlns:fb="http://www.facebook.com/2008/fbml">
<body>
<?php if ($user) { ?>
Your user profile is
<pre>
<?php print htmlspecialchars(print_r($user_profile, true)) ?>
</pre>
<?php } else { ?>
<fb:login-button></fb:login-button>
<?php } ?>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId: '<?php echo $facebook->getAppID() ?>',
cookie: true,
xfbml: true,
oauth: true
});
FB.Event.subscribe('auth.login', function(response) {
window.location.reload();
});
FB.Event.subscribe('auth.logout', function(response) {
window.location.reload();
});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
</body>
</html>
您可能需要启用ssl库,也可以检查Apache日志中的错误
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.