Currently, I have a website that allows users to upload images and at the same time I would like all these uploaded images to be published automatically to a Facebook page's albums. I used this CURL code below:
$args = array(
'message' => $imageDescription,
'access_token'=>$accesstoken,
'url' => $img
);
$ch = curl_init();
$url = 'https://graph.facebook.com/' . $albumid . '/photos';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$data = curl_exec($ch);
$response = json_decode($data,true);
From my test, this code works, but only for an hour, because I use the access token generated from the Graph API. This expiration is mentioned in https://developers.facebook.com/docs/pages/access-tokens#expire .
I have been looking around on Stack Overflow, and majority of the questions and answers mentioned the use of app ID and app secret to generate a new token, but this is a page and not an app. There is no app ID and app secret, so I am stuck.
So in this case, what can I do? Or is it not possible to use CURL in this case?