Download profile image from facebook not working any more

Question

This worked some days or weeks before:

$image = file_get_contents('https://scontent.xx.fbcdn.net/v/t1.0-1/p720x720/13001320_100996553638879_478536659476895885_n.jpg?oh=ec91a8418298a51403eaa306f62f9ab3&oe=58C0E384');
file_put_contents('bla.jpg', $image);

But now not anymore. I retrieve the URL this way:

function get_data($url) {
    $ch = curl_init();
    $timeout = 5;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
}

$returned_content = get_data('https://graph.facebook.com/' . $fbid . '/picture?height=600&redirect=false');
$array = json_decode($returned_content,true);
$array['data']['url']; // image url

Show source
| facebook   | php   | graph   2016-11-16 11:11 0 Answers

Answers to Download profile image from facebook not working any more ( 0 )

Leave a reply to - Download profile image from facebook not working any more

◀ Go back