File:  [mozdev] / annozilla / scripts / post_annotation.pl
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Fri Dec 20 12:06:33 2002 UTC (14 years, 10 months ago) by matthew
Branches: MAIN
CVS tags: HEAD, ANNOZILLA-ES-CHANGES, ANNOZILLA-ES, ANNOZILLA-CGH-CHANGES, ANNOZILLA-0-7-0, ANNOZILLA-0-6-7-BRANCH, ANNOZILLA-0-6-7
Script to post an annotation

#!/usr/bin/perl -w
use strict;
use Data::Dumper;
use LWP::UserAgent;
use Term::ReadKey;

my $server = 'http://annotest.w3.org/annotations';
my $user   = undef; # '<enter user name here>';
my $url    = undef; # '<enter URL of page to get annotations for here>';

die "No user defined\n" unless defined $user;
die "No url defined\n"  unless defined $url;

print "Enter annotation password:\n";
ReadMode 2;
my $password = ReadLine(0);
ReadMode 0;
chomp $password;

my @rdf = <DATA>;
my $ua = new LWP::UserAgent;

my $req = new HTTP::Request POST => $server;
$req->content_type('application/x-www-form-urlencoded');
$req->content(join "", @rdf);
$req->authorization_basic ($user, $password);

my $res = $ua->request($req);
die Dumper $res;

__DATA__
<?xml version="1.0"?>
<r:RDF>
...
</r:RDF>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>