Error getting photo from facebook friend via PHP SDK

Asked

Viewed 80 times

1

I’m using the Facebook SDK API to work with facebook. The SDK version I’m using is 2.8. I’m pulling up the list of my friends' Ids and I can successfully get.

What I need now is to get a picture of each of them, but I’m not getting it. Instead of returning the photo he returns a photo with "?" (interrogation). When it does not return this, it usually returns with the error message below:

(#12) picture edge for this type is deprecated for versions v2.3 and Higher

I tried everything, but nothing helped. I was trying like this:

https://graph.facebook.com/745290582220378/picture?type=normal => No good, back interrogation.

https://graph.facebook.com/745290582220378/picture?type=normal&access_token=TOKEN_DE_ACESSO_GERADO => No help returns the above mentioned error (#12) picture edge for this...

In my PHP code I used

$this->facebook->request('get', '/'.$FriendID.'/picture?type=large');

But gave the error quoted above.

I don’t know what to do and I need to deliver it to the client, but I don’t know how to fix it.

  • access your app’s https://graph.facebook.com/745290582220378 url and see what it returns

  • @Italorodrigo it asks for the token and if I put the token it returns me the friend ID only, nothing else.

  • check if your app registered on facebook is marked as desktop app, if you have, change to web app.

  • @Italorodrigo is for web now

  • 'Strange', Voce has sufficient permissions?

  • Yes, I am asking for permission from Friends List, Public Profile and Publication on the wall

Show 1 more comment

2 answers

0

I tried here and this happened: I accessed https://graph.facebook.com/745290582220378/picture?type=normal&access_token=... and got the error

(#12) picture edge for this type is deprecated for versions v2.3 and Higher

when accessing only https://graph.facebook.com/745290582220378?access_token=..., got the message:

Object with ID '745290582220378' does not exist

Which means this id doesn’t match any Facebook users. I tried again using my Facebook id and the first link worked perfectly. So I believe there is some error in getting the user id.

  • the code of my ID that I can also pick up with the script it generates the right image, but those of my friend not, that is strange

0

I did some tests in Graphapi Explorer on Facebook and the generated code was:

GraphRequest request = GraphRequest.newMeRequest(
  accessToken,
  new GraphRequest.GraphJSONObjectCallback() {
    @Override
    public void onCompleted(JSONObject object, GraphResponse response) {
      // Insert your code here
    }
});

Bundle parameters = new Bundle();
parameters.putString("fields", "id,name,picture,friends{picture,first_name,last_name}");
request.setParameters(parameters);

    request.executeAsync();

See that the address of the photos of friends are in Friends>picture. Here I could see all the photos. See if you can adapt to your project.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.