Facebook auth with PHP SDK -


i'm trying authorize php sdk.

$facebook = new facebook(array(             'appid'  => 'xxx',             'secret' => 'xxx', )); $user = $facebook->getuser(); if($user) {       $user_profile = $facebook->api('/me'); }  <a href="#" onclick='mywin=window.open("<?php echo $facebook->getloginurl(array('redirect_uri'=>home_url().'/auth.php')); ?>", "", "width=500,height=400");'">facebook</a> 

this piece of code should authorize me , profile. redirect_url script looks this

echo "<html><head><meta charset='utf-8'/></head><body><script>          var form=window.opener.document.createelement(\"form\");          form.id = \"red\"          form.action='';          form.method=\"post\";          form.target=\"_top\";          form.style.display=\"none\";          var input=document.createelement(\"input\");          input.type=\"hidden\";          input.name=\"fb_auth\";          input.value='';form.appendchild(input);          window.opener.document.body.appendchild(form);          form.submit();          window.close();      </script></body></html>"; 

so $user 0. wrong?


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -