如您所见,下面的代码从 Facebook 个人资料中检索并显示所有必需信息。访问令牌:用户 ID:姓名:Aneesh 名字:姓氏:电子邮件:性别:生日:位置:N 时区:
但我无法将个人资料图片存储在 sql 数据库中?
<?php
require 'lib/db.php';
require 'lib/facebook.php';
require 'lib/fbconfig.php';
session_start();
$facebook=$_SESSION['facebook'];
$userdata=$_SESSION['userdata'];
$logoutUrl=$_SESSION['logout'];
$access_token_title='fb_'.$facebook_appid.'_access_token';
$access_token=$facebook[$access_token_title];
if(!empty($userdata))
{
echo '<h1>Login User Details</h1>';
echo '<img src="https://graph.facebook.com/'.$userdata['id'].'/picture">';
目前上面的代码显示图像...但是如何存储是我使用 BLOB 显示错误的问题
echo "<br/>";
echo '<b>Access Token: </b>'.$access_token;
echo "<br/>";
echo '<b>User ID: </b>'.$userdata['id'];
echo "<br/>";
echo '<b>Name: </b>'.$userdata['name'];
echo "<br/>";
echo '<b>First Name: </b>'.$userdata['first_name'];
echo "<br/>";
echo '<b>Last Name: </b>'.$userdata['last_name'];
echo "<br/>";
echo '<b>Email: </b>'.$userdata['email'];
echo "<br/>";
echo '<b>Gender: </b>'.$userdata['gender'];
echo "<br/>";
echo '<b>Birthday: </b>'.$userdata['birthday'];
echo "<br/>";
echo '<b>Location: </b>'.$userdata['location']['name'];
echo "<br/>";
echo '<b>Time Zone: </b>'.$userdata['timezone'];
echo "<br/>";
echo "<br/>";
$facebook_id=$userdata['id'];
$name=$userdata['name'];
$email=$userdata['email'];
$gender=$userdata['gender'];
$birthday=$userdata['birthday'];
$location=mysql_real_escape_string($userdata['location']['name']);
$hometown=mysql_real_escape_string($userdata['hometown']['name']);
$bio=mysql_real_escape_string($userdata['bio']);
$relationship=$userdata['relationship_status'];
$timezone=$userdata['timezone'];
$inserty = "INSERT INTO `users` (`facebook_id`, `name`, `email`, `gender`, `birthday`, `location`,`timezone`, `access_token`,`??????`)
VALUES ('$facebook_id','$name','$email','$gender','$birthday','$location','$timezone','$access_token',`?????`)";
mysql_query($inserty, $connection);
???我的意思是图片栏
echo "<br/>";
echo '<a href="'.$logoutUrl.'">Logout Facebook</a>';
echo '<a href="http://www.xxxxxx.co.uk/Mosaic/logout.php">Logout Facebook</a>';
include('status_update.php');
}
else
{
header("Location: fblogin.php");
}
?>