Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP] Problem z ustawieniem logowania przez facebook
domain
post
Post #1





Grupa: Zarejestrowani
Postów: 1
Pomógł: 0
Dołączył: 8.09.2012

Ostrzeżenie: (0%)
-----


Witam,
mam problem z ustawieniem logowania przez facebook.
Problem pojawia się gdy chce pobrać dane i je wyświetlić na stronie np "witaj (nazwa użytkownika).
zrobiłem plik textowy z taką zawartością:
  1. function get_facebook_cookie($app_id, $app_secret) {
  2. $args = array();
  3. parse_str(trim($_COOKIE['fbs_' . $app_id], '\\"'), $args);
  4. ksort($args);
  5. $payload = '';
  6. foreach ($args as $key => $value) {
  7. if ($key != 'sig') {
  8. $payload .= $key . '=' . $value;
  9. }
  10. }
  11. if (md5($payload . $app_secret) != $args['sig']) {
  12. return null;
  13. }
  14. return $args;
  15. }
  16.  
  17. $cookie = get_facebook_cookie('100410860******',
  18. 'a636fa9c4522c7129b35***********');
  19.  
  20. $user = json_decode(file_get_contents(
  21. 'https://graph.facebook.com/me?access_token=' .
  22. $cookie['access_token']));
  23.  
  24. print_r($user);


potem za pomocą include wstawiam go na strone a w miejscu gdzie ma się wyświetlić imię i nazwisko wstawiam:
  1. echo "Witaj, ".$user->name;


wyskakuje mi błąd:
stdClass Object ( [error] => stdClass Object ( [message] => An active access token must be used to query information about the current user. [type] => OAuthException [code] => 2500 ) ) Witaj,
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.09.2025 - 09:59