Autor | Zpráva | ||
---|---|---|---|
countdown Profil |
#1 · Zasláno: 29. 12. 2011, 19:11:59
Dobrý den,
chci na svém webu udělat registraci přes facebook a narazil jsem na problém: <?php define('YOUR_APP_ID', 'id mé aplikace'); define('YOUR_APP_SECRET', 'id secret mé aplikace'); function get_facebook_cookie($app_id, $app_secret) { $args = array(); parse_str(trim($_COOKIE['fbs_' . $app_id], '\\"'), $args); ksort($args); $payload = ''; foreach ($args as $key => $value) { if ($key != 'sig') { $payload .= $key . '=' . $value; } } if (md5($payload . $app_secret) != $args['sig']) { return null; } return $args; } $cookie = get_facebook_cookie(YOUR_APP_ID, YOUR_APP_SECRET); $user = json_decode(file_get_contents( 'https://graph.facebook.com/me?access_token=' . $cookie['access_token'])); ?> <html> <head> </head> <body> <?php if ($cookie) { ?> Welcome <?= $user->name ?> <?php } else { ?> <fb:login-button></fb:login-button> <?php } ?> <div id="fb-root"></div> <script> window.fbAsyncInit = function() { FB.init({ appId : '<?= YOUR_APP_ID ?>', status : true, cookie : true, xfbml : true, oauth : true, }); FB.Event.subscribe('auth.login', function(response) { window.location.reload(); }); }; (function(d){ var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;} js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_US/all.js"; d.getElementsByTagName('head')[0].appendChild(js); }(document)); </script> </body> </html> Po načtení stránky se zobrazí: Warning: file_get_contents(https://graph.facebook.com/me?access_token=) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request in /data/web/virtuals/11847/virtual/www/subdom/countdown/index.php on line 26 Nevíte co s tím? |
||
countdown Profil |
#2 · Zasláno: 29. 12. 2011, 22:29:19
Nikdo nemá zkušenosti s přihlašováním přes facebook?
|
||
Časová prodleva: 4 dny
|
|||
Taps Profil |
#3 · Zasláno: 3. 1. 2012, 07:21:13
|
||
Časová prodleva: 12 let
|
0