Line 0
Link Here
|
0 |
- |
1 |
#!/usr/bin/perl |
|
|
2 |
|
3 |
use warnings; |
4 |
use strict; |
5 |
|
6 |
use LWP::UserAgent; |
7 |
use File::Slurp; |
8 |
|
9 |
my $url = 'http://srvgit.koha-dev.rot13.org:8080/cgi-bin/koha/svc'; |
10 |
|
11 |
my $biblionumber = 252283; |
12 |
|
13 |
my $file = "bib-$biblionumber.marcxml"; |
14 |
|
15 |
my $user = 'svcuser'; |
16 |
my $password = 'svcpasswd'; |
17 |
my $debug = 1; |
18 |
|
19 |
my $ua = LWP::UserAgent->new(); |
20 |
$ua->cookie_jar({}); |
21 |
my $resp = $ua->post( "$url/authentication", {userid =>$user, password => $password} ); |
22 |
die $resp->status_line unless $resp->is_success; |
23 |
|
24 |
if ( ! -e $file ) { |
25 |
|
26 |
$resp = $ua->get( "$url/bib/$biblionumber", userid =>$user, password => $password ); |
27 |
die $resp->status_line unless $resp->is_success; |
28 |
write_file $file, $resp->decoded_content; |
29 |
print "saved $file ", -s $file, " bytes\n"; |
30 |
|
31 |
} |
32 |
|
33 |
print $resp->decoded_content; |
34 |
|
35 |
$resp = $ua->post( "$url/bib/$biblionumber", {userid =>$user, password => $password} ); |
36 |
die $resp->status_line unless $resp->is_success; |
37 |
|
38 |
print "Authentication successful\n"; |
39 |
|
40 |
my $resp = $ua->post( "$url/bib/$biblionumber", {userid =>$user, password => $password, |
41 |
POSTDATA => scalar read_file($file), |
42 |
} ); |
43 |
|
44 |
print $resp->status_line; |
45 |
|
46 |
die $resp->status_line unless $resp->is_success; |
47 |
|