kristobaljunta / vkontakte-wall-posting
A class for posting to Vkontakte public pages & groups
v1.1.4
2018-07-04 15:01 UTC
Requires
- php: >=5.3.0
- ext-curl: *
- ext-json: *
This package is not auto-updated.
Last update: 2024-09-19 16:50:42 UTC
README
Vkontakte Wall Posting
A class for posting to Vkontakte public pages & groups
require_once('../vendor/autoload.php'); use KristobalJunta\Vkontakte; $accessToken = 'your access token'; $publicID = 'your public ID here'; $vkAPI = new Vkontakte(['access_token' => $accessToken]); $attachments = [ 'images' => [ # attaching image by url [ 'type' => 'image', 'url' => 'image-link' ], # attaching image by full file path [ 'type' => 'image', 'path' => '/full/path/to/image' ] ] # attaching link (there can be only one) 'link' => 'link-url' ]; if ($vkAPI->postToPublic($publicID, "Hello world", $attachments, ['#вконтакте api', '#автопостинг', '#первые шаги'])) { echo "Yeah, success!\n"; } else { echo "Error publishing post\n"; }