mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-25 19:00:03 +03:00
sample perl script to use pwg.images.addSimple
This commit is contained in:
parent
a96d89e9d9
commit
21dc3b8490
1 changed files with 36 additions and 0 deletions
36
tools/piwigo_addSimple.pl
Normal file
36
tools/piwigo_addSimple.pl
Normal file
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use LWP::UserAgent;
|
||||
|
||||
my %conf = (
|
||||
base_url => 'http://localhost/pwggit',
|
||||
);
|
||||
|
||||
my $ua = LWP::UserAgent->new;
|
||||
$ua->cookie_jar({});
|
||||
|
||||
$ua->post(
|
||||
$conf{base_url}.'/ws.php',
|
||||
{
|
||||
method => 'pwg.session.login',
|
||||
username => 'plg',
|
||||
password => 'plg',
|
||||
}
|
||||
);
|
||||
|
||||
my $response = $ua->post(
|
||||
$conf{base_url}.'/ws.php',
|
||||
{
|
||||
method => 'pwg.images.addSimple',
|
||||
image => ['/Users/plg/Documents/IMG_7779.jpg'],
|
||||
category => 6,
|
||||
tags => 'tag1, tag2, another tag',
|
||||
name => 'A nice title',
|
||||
comment => 'A longer description',
|
||||
author => 'Paul Nikanon',
|
||||
level => 0,
|
||||
},
|
||||
'Content_Type' => 'form-data',
|
||||
);
|
||||
|
||||
use Data::Dumper; print Dumper($response->message);
|
Loading…
Add table
Add a link
Reference in a new issue