简体   繁体   中英

How do I get picture's profile using the api php facebook?

Hear is my code. I would like to get picture with api php facebook. The variable $photo returns NULL value.

<?php
    $profile = $facebook->api('/<idfacebook>');
    $photo = $facebook->api('/'.$profile['username'].'/picture');
?>

From stackoverflow.com/questions/2821061

"Simply fetch the data through this url: http://graph.facebook.com/sarfraz.anees/picture

Replace sarfraz.anees (my name) with name of the user you want to get the photo of. You can use the PHP's file_get_contents function to read that url and process the retrieved data.

Resource: http://developers.facebook.com/docs/api

Note: In php.ini, you need to make sure that openssl extension is enabled to use the file_get_contents function of PHP to read that url. "

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM