Skip to content

Instantly share code, notes, and snippets.

@lgg lgg/index.php
Created Oct 30, 2017

Embed
What would you like to do?
[VK] Move photos from saved to another album
<?php
/*
1. git clone https://github.com/fdcore/vk.api
2. mv vk.api/src/vk.php ./vk.php
3. edit file index.php below
*/
include __DIR__ . '/vk.php';
$user_id = 1; //YOUR VK USER ID
$user_token = ""; //YOUR VK USER TOKEN (see https://github.com/fdcore/vk.api to check how you will get it)
$user_target_album_id = 12345; //TARGET VK ALBUM ID
$app_secret = 'sadasd12sda'; //YOUR VK APP SECRET
$app_id = 123; //YOUR VK APP ID
$config['secret_key'] = $app_secret;
$config['client_id'] = $app_id; // app client id
$config['user_id'] = $user_id; // id current user (required
$config['access_token'] = $user_token;
$config['scope'] = 'photos'; // scope access
$v = new Vk($config);
$response = $v->photos->get(array(
'owner_id' => $user_id,
'album_id' => 'saved',
'count' => 1000,
));
foreach($response["items"] as $res){
$response = $v->photos->move(array(
'owner_id' => $user_id,
'target_album_id' => $user_target_album_id,
'photo_id' => $res["id"],
));
sleep(1);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.