문제

I am trying to store the raw url for a FB image in my DB (the url that is redirected to from a Facebook image graph request). I am trying to do this in PHP. I am trying to use:

$raw_picture = json_decode('https://graph.facebook.com/'.$somefbid.'/picture?width=720&height=720', true);
        $data['picture'] = $raw_picture['url'];
        dd($data['picture']);

The dd line returns NULL.

Do you know how I get the raw url from this type of request? Thank you.

도움이 되었습니까?

해결책

You can use the additional parameter redirect=0 like this:

GET /me/picture?redirect=0

the output is:

{
  "data": {
    "url": "{url}", 
    "is_silhouette": false
  }
}

See https://developers.facebook.com/docs/graph-api/reference/v2.0/user/picture/ for reference.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top