Facebook Connect php sdkを使用してWebサイトを作成しています。Facebookを使用してログインすると、Facebookに正しくログインしますが、ユーザーがWebサイトに登録されていないため、ユーザーはログインしていません。名、姓、リンクなどのすべての詳細を表示するフェイスブックですが、電子メールとユーザー名のフィールドは空のままです。
This is my code,
> require 'facebook.php'; $facebook = new Facebook(array( 'appId' =>
> 'xxxxxxxxxx', 'secret' => 'xxxxxxxxxxxxxxxxxxxxxxx',
> ));
>
> $user = $facebook->getUser();
>
> $loginUrl = $facebook->getLoginUrl();
>
> if ($user) { try {
> $user_profile = $facebook->api('/me'); } catch (FacebookApiException $e) {
> error_log($e);
> $user = null; } } if ($user) {
> $facebook_userdetails = $facebook->api ( '/me' );
> // print_r($facebook_userdetails); exit; if (is_array($facebook_userdetails ))
> {
> $FBId = $facebook_userdetails ['id'];
> $FBName = $facebook_userdetails ['name'];
> $FBFirstName = $facebook_userdetails ['first_name'];
> $FBLastName = $facebook_userdetails ['last_name'];
> $FBLink = $facebook_userdetails ['link'];
> $FBUsername = $facebook_userdetails ['username'];
> $FBGender = $facebook_userdetails ['gender'];
> $FBEmail = $facebook_userdetails ['email'];
> $FBTimezone = $facebook_userdetails ['timezone'];
> $FBLocale = $facebook_userdetails ['locale'];
> $FBVerified = $facebook_userdetails ['verified'];
> $FBUpdated_time = $facebook_userdetails ['updated_time'];
> }
> else
> $this->view->error = $facebook_userdetails; echo "<body onLoad='myfunc()'>
> <form name='facebook' action='fbconnect_login.php' method='POST' id='face'>
> <input type='hidden' name='FBId' value='$FBId' />
> <input type='hidden' name='FBName' value='$FBName' />
> <input type='hidden' name='FBFirstName' value='$FBFirstName' />
> <input type='hidden' name='FBLastName' value='$FBLastName' />
> <input type='hidden' name='FBLink' value='$FBLink' />
> <input type='hidden' name='FBUsername' value='$FBUsername' />
> <input type='hidden' name='FBGender' value='$FBGender' />
> <input type='hidden' name='FBEmail' value='$FBEmail' />
> <input type='hidden' name='FBTimezone' value='$FBTimezone' />
> <input type='hidden' name='FBLocale' value='$FBLocale' />
> <input type='hidden' name='FBVerified' value='$FBVerified' />
> <input type='hidden' name='FBUpdated_time' value='$FBUpdated_time' />
> </form> </body>" ; $logoutUrl = $facebook->getLogoutUrl(); } else { $loginUrl =
> $facebook->getLoginUrl(); echo "<script>window.location =
> '$loginUrl';</script>"; } $naitik = $facebook->api('/naitik'); ?>
> <script type="text/javascript"> function myfunc () { var frm =
> document.getElementById("face"); frm.submit(); } </script>
これは私のHTMLコンテンツです。
<a id="fb-login" style="background:none;width:auto;height:25px;" class="fb_button fb_button_medium" href="javascript:void(0);">Login With Facebook</a>
<script type="text/javascript">
$('#fb-login').click(function()
var left = (screen.width/2)-(800/2);
var top = (screen.height/2)-(400/2);
signinWin = window.open("https://www.facebook.com/dialog/oauth?client_id=375057399186229&redirect_uri=http%3A%2F%2Flivedev.pharmacydirect.co.nz%2Fweb%2Ffb_main.php&state=69d3e5e4348786ab4bb4ab7f723c931a", "SignIn", "width=800,height=400,toolbar=0,scrollbars=1,status=0,resizable=0,location=0,menuBar=0,left="+left+",top="+top);
setTimeout(CheckLoginStatus, 2000);
signinWin.focus();
return false;
);
function CheckLoginStatus()
if (signinWin.closed)
window.location.reload();
else setTimeout(CheckLoginStatus, 1000);
</script>
助けてください、よろしくお願いします........