iamaracinghorse
iamaracinghorse

Reputation: 35

How do i retrieve the url of an image uploaded via Facebook's graph api

I've successfully uploaded an image to user's album using the following code:

    $ch = curl_init();
    $url = 'https://graph.facebook.com/'.$uid.'/photos?access_token='.$token;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
    $data = curl_exec($ch);

can anyone tell me how I would then retrieve the public link to that image?

Upvotes: 0

Views: 406

Answers (2)

Denis
Denis

Reputation: 4115

Succesful photo upload returns id for the uploaded picture. Use that id to request extended info about the picture (graph.facebook.com/[photoid]?access_token=...)

Upvotes: 0

grmartin
grmartin

Reputation: 1459

I have more experience FQL however, it looks like this might work:

https://graph.facebook.com/me/picture

Documentation is under "connections"

http://developers.facebook.com/docs/reference/api/user

If you choose to use FQL:

http://developers.facebook.com/docs/reference/fql/

http://developers.facebook.com/docs/reference/fql/profile

Upvotes: 1

Related Questions