I am trying to download Facebook profile picture for Facebook application. For this, I'm getting the value of Facebook username/id in $uid
. echo $uid
is showing the correct result but it's not picking up the value when I use it in the following code:
echo $uid;
$imgDestinationPath = 'pic.jpg';
$link = 'http://graph.facebook.com/$uid/picture?type=large';
$content = file_get_contents($link);
file_put_contents($imgDestinationPath, $content);
error_reporting(E_ALL);
Moreover, when I put the Facebook username instead of $uid
, it downloads the picture then.
Please help. I'm new to PHP.