0

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');
?>
Fabio
  • 141
  • 4
  • 13
  • This might help you... http://stackoverflow.com/questions/2821061/facebook-api-how-do-i-get-a-facebook-users-profile-image-through-the-fb-api – om39a Jun 15 '12 at 14:45

1 Answers1

1

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. "

ka_lin
  • 8,596
  • 5
  • 31
  • 50