Getting the “real” Facebook profile picture URL from graph API

后端 未结 12 2044
说谎
说谎 2020-12-12 15:25

Facebook graph API tells me I can get a profile picture of a user using

http://graph.facebook.com/517267866/picture?type=large

which works fine. However, whe

12条回答
  •  星月不相逢
    2020-12-12 16:12

    $url = 'http://graph.facebook.com/100000771470028/picture?type=large';
    $rray=get_headers($url);
    $hd = $rray[4];
    echo(substr($hd,strpos($hd,'http')));
    

    This will return the url that you asked, and the problem of changing the url by facebook doesn't matter because you are dynamically calling the url from the original url.

提交回复
热议问题