0
贴我是新来Facebook的图形API,但我知道的基本知识。现在我需要所有关于如何阅读用户墙帖和其他张贴在任何用户的墙上的其他人的帮助,请拨打read_stream
。但我不知道该怎么称呼它。我尝试了一些方法,但我只能读取名称和基本信息。阅读对象时需要帮助。请帮帮我!!!读取用户的墙后和其他人谁在墙上
<?php
define('FACEBOOK_APP_ID', 'xxxxxx');
define('FACEBOOK_SECRET', 'xxxxxx');
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_ID, FACEBOOK_SECRET);
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:fb="http://www.facebook.com/2008/fbml">
<body>
<?php
echo 'Your Facebook ID: '.$cookie;
if ($cookie) {
//cookie is set, user is logged in
$user = json_decode(file_get_contents('http://graph.facebook.com/'.$cookie['uid']));
//Display the facebook user ID, name, gender and Facebook URL in the web browser
echo '<br />';
echo 'Your Facebook ID: '.$user->{'id'};
echo '<br />';
echo 'Your name: '.$user->{'name'};
echo '<br />';
echo 'Your gender: '.$user->{'gender'};
echo '<br />';
echo 'Your Facebook URL: '.$user->{'link'};
echo '<br />';
echo '<img src="http://graph.facebook.com/'.$user->{'id.'/picture" alt="'.$user-> {'name'}.'"/>';
echo '<br />';
echo '<fb:login-button autologoutlink="true"></fb:login-button>';
}
else
{
//user is not logged in, display the Facebook login button
echo '<h2>Facebook Application Test page</h2>';
echo '<br />';
echo' message somethng';
</body>
</html>
感谢您的帮助,但现在这两个错误突然跳出: 警告:的file_get_contents(http://graph.facebook.com//feed/?access_token=)function.file-GET-内容] :无法打开流:HTTP请求失败! HTTP /在/data/multiserv/users/491819/projects/1209278/www/fb/abc.php 1.0 500内部服务器错误在线路34上 警告:/数据/ multiserv /用户提供的foreach()无效的参数/ 491819 /项目/ 1209278/WWW/FB /上线35 – 2011-12-15 11:23:12