-1

有人知道如何从 Json 数据中获取个人资料图片,我获得了所有信息(用户名、名字、FacebookId),但我无法获得个人资料图片的链接:

namespace djepo\UserBundle\Security\User\Provider;

use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Core\User\UserInterface;
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']));

      .....
       ....
4

1 回答 1

0

如果你有他们的用户名,你需要做的就是卷曲以下内容:

http://graph.facebook.com/username/picture

您可能需要在 curlopt 设置中允许重定向。

于 2013-01-02T14:52:10.430 回答