mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-03-28 17:42:57 +01:00
sample perl script to use pwg.images.addSimple
This commit is contained in:
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);
|
||||
Reference in New Issue
Block a user