有人知道如何从Json数据获得个人资料图片,我得到所有信息(用户名,名,facebook),但我不能有我的个人资料图片的链接:
namespace djepoUserBundleSecurityUserProvider;
use SymfonyComponentSecurityCoreExceptionUsernameNotFoundException;
use SymfonyComponentSecurityCoreExceptionUnsupportedUserException;
use SymfonyComponentSecurityCoreUserUserProviderInterface;
use SymfonyComponentSecurityCoreUserUserInterface;
use BaseFacebook;
use FacebookApiException;
class FacebookProvider implements UserProviderInterface
{
/**
* @var Facebook
*/
protected $facebook;
protected $userManager;
protected $validator;
....
....
public function loadUserByUsername($username)
{
$user = $this->findUserByFbId($username);
try {
$fbdata = $this->facebook->api('/me');// Here I Get all information without pic
} catch (FacebookApiException $e) {
$fbdata = null;
}
if (!empty($fbdata)) {
var_dump($fbdata);// here I see object with result of data
exit();
$user_by_mail=$this->userManager->findUserBy(array('email'=>$fbdata['email']));
.....
....
如果您有他们的用户名,您需要做的就是卷曲以下内容:
http://graph.facebook.com/username/picture您可能需要在您的curlopt设置中允许重定向