I have a PHP script that upload an image+description+other details on my facebook fanpage wall. But what i need is to upload INSIDE an Album. I'm looking all over the internet for this answer, this tutorial is the closest i got until now.
Here's my code:
$params = array(
"access_token" => $page_token,
"message" => "#php #facebook",
"link" => "www.domain.com.br",
"description" => "Buy this now!",
"source" => "@" . $path,
);
try {
$ret = $fb->api('/'.$album_id . '/photos', 'POST', $params);
echo 'Successfully posted to Facebook Fan Page';
} catch(Exception $e) {
echo $e->getMessage();
}
I have already tried to change this $ret = $fb->api('/'.$fanpage_id . '/photos', 'POST', $params);
path to this one: $ret = $fb->api('/'.$fanpage_id.'/'.$album_id . '/photos', 'POST', $params);
and something similar.
But it returns (#240) The target_id references an inactive user
because fb API thinks that $album_id
is the $fanpage_id
.
if somebody knows how to post a picture inside the album, please help me ;)
Here it is, this code checks if the album with the name you want exists, if not creates a new one: