Post Updates to Buffer Using the Buffer API

Post updates to buffer using this library – https://github.com/thewebguy/bufferapp-php details documentation about the api is available from https://buffer.com/developers/api

session_start();
require('buffer.php');

$client_id = 'yourid';
$client_secret = 'yoursecret';
$callback = 'yourcallbackurl'

$buffer = new BufferApp($client_id, $client_secret, $callback);

 if (!$buffer->ok) {
    echo '<a href="' . $buffer->get_login_url() . '">Connect to Buffer!</a>';
} else {
    //social media profile ids
    $profiles = array(
        '561aa0563v24244c321316b1', 
        '561aa056563bb32c321316b1'
    );

    //loop through each one and post to buffer
    foreach($profiles as $profile){
        $buffer->go('/updates/create', array(
            'text' => 'My article title',
            'media[title]'=>  'My article title',
            'media[link]'=>  'http://domain.com',
            'media[description]'=>  'you will love this story!',
            'media[picture]'=>  'http://domain.com/images/story.jpg',
            'media[thumbnail]'=>  'http://domain.com/images/story.jpg',
            'profile_ids[]' => $profile
        ));
    }
}
Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn