View Single Post
ישן 03-01-11, 16:57   # 7
dor77
חבר וותיק
 
מיני פרופיל
תאריך הצטרפות: Jan 2008
הודעות: 1,650

dor77 לא מחובר  

הצלחתי..זה עובד אבל..כשאני נותן את הסכמתי לאפילקציה זה מראה לי:
Your user ID is 14*****984
אני רוצה לקבל מפייסבוק את ה id שלו ואת השם משתמש שלו..איך אני עושה את זה?

זה הקוד:
PHP קוד:
<?php

define
('FACEBOOK_APP_ID''178*********56686');
define('FACEBOOK_SECRET''1dc3************39543031');

function 
get_facebook_cookie($app_id$application_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 $application_secret) != $args['sig']) {
return 
null;
}
return 
$args;
}

$cookie get_facebook_cookie(FACEBOOK_APP_IDFACEBOOK_SECRET);

?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:fb="http://www.facebook.com/2008/fbml">
<body>
<?php if ($cookie) { ?>
Your user ID is <?= $cookie['uid'?>
<?php 
} else { ?>
<fb:login-button></fb:login-button>
<?php ?>

<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({appId: '<?= FACEBOOK_APP_ID ?>', status: true,
cookie: true, xfbml: true});
FB.Event.subscribe('auth.login', function(response) {
window.location.reload();
});
</script>
</body>
</html>
תודה
__________________
מתכנת php אמין ומקצועי.
מחירים נוחים!
יצירת קשר: 0544378743
  Reply With Quote