VK::App is a Perl module for creation of client applications based on OAuth 2.0, receiving access rights and sending requests to API vk.com. First, you need to get api_id application that will work with the API of vk.com. You can register your application at http://vk.com/apps.php?act=add or use api_id of the existing application.
This package also includes scripts/vmd.pl script, that shows how to use the module.
SYNOPSIS
### Application object creation ###
#1. Authorizing by login and password
use VK::App;
my $vk = VK::App->new(
# Your email or mobile phone to vk.com
login => 'login',
# Your password to vk.com
password => 'password',
# The api_id of application
api_id => 'api_id',
# Name of the file to restore cookies from and save cookies to
#(this parameter is optional in this case)
cookie_file => '/home/user/.vk.com.cookie',
);
#2. Authorizing by cookie file
use VK::App;
my $vk = VK::App->new(
# Name of the file to restore cookies from and save cookies to
cookie_file => '/home/user/.vk.com.cookie',
# The api_id of application
api_id => 'api_id',
);
#3. Set additional options
use VK::App;
my $vk = VK::App->new(
# Name of the file to restore cookies from and save cookies to
cookie_file => '/home/user/.vk.com.cookie',
# The api_id of application
api_id => 'api_id',
# Set application access rights
scope => 'friends,photos,audio,video,wall,groups,messages,offline',
# Data format that will receive as a result of requests 'JSON', 'XML' or 'Perl'.
# Perl object by default.
format => 'Perl',
);
### Requests examples ###
#1. Get user id by name
my $user = $vk->request('getProfiles',{uid=>'genaev',fields=>'uid'});
my $uid = $user->{response}->[0]->{uid};
#2. Get a list of tracks by uid
my $tracks = $vk->request('audio.get',{uid=>$uid});
my $url = $tracks->{response}->[0]->{url}; # get url of the first track
Product's homepage
Requirements:
· Perl