Pregunta

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.

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top