Reputation: 141
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');
?>
Upvotes: 0
Views: 1541
Reputation: 9442
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. "
Upvotes: 1