Daniela Răducanu
Daniela Răducanu

Reputation: 47

How to fetch facebook email address?

How can I access the array to fetch the email address? I tried something like "$userInfo->['email'];

$userInfo = $facebook -> api("/$user");
print_r($userInfo);

Output:

Array ( 
    [id] => 1790302499 
    [name] => Lorem Ipsum
    [first_name] => Lorem 
    [last_name] => Ipsum 
    [link] => http://www.facebook.com/Lorem.Ipsum
    [username] => Lorem.Ipsum
    [birthday] => 11/11/1991 
    [location] => Array ( 
        [id] => 114304221920174 
    ) 
    [work] => Array ( 
        [0] => Array ( 
            [employer] => Array ( 
                [id] => 114304221920174 
                [name] => Google.com 
            ) 
            [start_date] => 0000-00 
        ) 
    ) 
    [gender] => male 
    [email] => [email protected] 
    [verified] => 1 
)

Thank you in advance !!

Upvotes: 0

Views: 210

Answers (1)

Dejan Marjanović
Dejan Marjanović

Reputation: 19380

Array - $userInfo['email']

Object - $userInfo->email

Upvotes: 2

Related Questions