my code
try { $response = $fb->get('/me?fields=id,name,gender,email,picture', $accesstoken); } catch(facebook\exceptions\facebookresponseexception $e) { echo 'graph returned error: ' . $e->getmessage(); exit; } catch(facebook\exceptions\facebooksdkexception $e) { echo 'facebook sdk returned error: ' . $e->getmessage(); exit; } $user = $response->getgraphuser(); echo 'name:'.$user['name']."</br>"; echo 'gender:'.$user['gender']."</br>"; echo 'picture:'.$user['picture']."</br>"; echo 'email:'.$user['email']."</br>";
my output
name:siddhu siddhartha roy gender:male picture:{"is_silhouette":false,"url":"https://scontent.xx.fbcdn.net/v/t1.0-1/p50x50/12295307_890342681035161_8265283125930543183_n.jpg? oh=f8198fc14435078e584749f2d55dcd8e&oe=5833fdcd"} email:siddhu.08pc1a0413@gmail.com
my problem
i'm unable show profile picture.. when goto url
https://scontent.xx.fbcdn.net/v/t1.0-1/p50x50/12295307_890342681035161_8265283125930543183_n.jpg
it shows content not found
simple: you're getting data in json format. decode result.
$json = json_decode($user['picture'], true); echo $json['url'];
Comments
Post a Comment