superkozel/vk-repost — pull request #1 by DragonMaxTMD (2013-10-04 04:57:07+00:00)
Title: Update example.php

login();
$callback = 'http://api.vk.com/blank.html';
$code = $public->auth($callback);
$secret = $public->getSecret($callback, $code);
$public->setAccessData($secret['access_token'], $secret['secret']);

if (!empty($images)){
$uploads = [];
foreach ($images as $image){
$uploads[] = $public->createPhotoAttachment($image);
}
$chunks = array_chunk($uploads, 10);//разбиваем картинки по 10 штук - ограничение VK
foreach ($chunks as $chunk){
$attachString = join(',', $chunk);
$public->wallPostAttachment($attachString, $message);
}
}
else{
$public->wallPostMsg($message);
}
}