N
N
Nikita Kozlovsky2015-12-10 13:34:17
PHP
Nikita Kozlovsky, 2015-12-10 13:34:17

Upload images to facebook album, php sdk, how to get list of albums?

Good afternoon!
I'm trying to implement auto-posting to a facebook page, I managed to publish a post, but only without an image. I found that you first need to upload the image to the album, and then attach it to the post by id.
I'm trying to get a list of page albums

require_once __DIR__ . '/ss/Facebook/autoload.php';

$app_id = "1234567";
$app_secret = "asdf1234";
$page_id = "111111";
$token = "qwerty";

$fb = new Facebook\Facebook([
    'app_id'  => $app_id,
    'app_secret' => $app_secret,
    'default_graph_version' => 'v2.5',
  ]);

$albums = $fb->get("/{$page_id}/albums", $token)->getGraphEdge()->asArray();

but in the end I get nothing.
Has anyone done this, can you tell me what I'm doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
IIISpikerIII, 2015-12-11
@IIISpikerIII

User_photos access is required to get albums in FB, did you get it in the application panel?
Status & Review -> Items in Review -> Add Items to this Submission

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question