
session_start();
require('buffer.php');
$client_id = 'your_id';
$client_secret = 'your_secret';
$buffer = new BufferApp($client_id, $client_secret, null);
note: above in my case ,i don't require to put callback url, so i left null.
Class will store the token in session .Find below hard coded token . function retrieve_access_token() {
$this->access_token = 'token';//$_SESSION;
if ($this->access_token) {
$this->ok = true;
}
}
Setting profile's id as shown below $profiles = $buffer->go('/profiles');
//print_r($profiles);
Now , Loop over the Id's and post to Buffer, pass an array to updates/create the only part the array that is required the profile_ids the rest are optional foreach($profiles as $profile){
$buffer->go('/updates/create', array(
'text' => 'My website heading',
'media'=> 'My website heading ',
'media'=> 'https://yourwebdomain.com',
'media'=> 'Here will be sample description!',
'media'=> 'https://yourwebdomain.com/images/abc.webp',
'media'=> 'https://yourwebdomain.com/images/abc.webp',
'profile_ids' => $profile
));
}
it updates to your schedules on Buffer .
Find below complete code in one place . session_start();
require('buffer.php');
$client_id = 'your_id';
$client_secret = 'your_secret';
$buffer = new BufferApp($client_id, $client_secret, null);
$profiles = array(
'561aa0563v24244c321316b1',
'561aa056563bb32c321316b1',
);
foreach($profiles as $profile){
$buffer->go('/updates/create', array(
'text' => 'My website heading',
'media'=> 'My website heading ',
'media'=> 'https://yourwebdomain.com',
'media'=> 'Here will be sample description!',
'media'=> 'https://yourwebdomain.com/images/abc.webp',
'media'=> 'https://yourwebdomain.com/images/abc.webp',
'profile_ids' => $profile
));
}