[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[handle-dev] Batch Uploading
Hi all,
I am constructing a script to upload our XML metadata files to CrossRef.
At the meeting in New York Mark suggested that Perl's LWP module would
post the metadata file to CrossRef. I'm not exactly sure how this is
done. Below is some Perl code that I have put together that posts data
to the web server. Does anyone know how to post multi-part form data
using perl? I have looked through all the Perl books and they don't
touch on this topic. Any help is appreciated, thanks.
# Create a user agent object
use LWP::UserAgent;
$ua = new LWP::UserAgent;
$ua->agent("AgentName/0.1 " . $ua->agent);
# Create a request
my $req = new HTTP::Request POST =>
'http://deposit.crossref.org/xmlbatch/LoadXML';
$req->content_type('multipart/form-data');
$req->content('login_passwd=<login>&name_auth=<auth>&login_id=<login_id>');
# Pass request to the user agent and get a response back
my $res = $ua->request($req);
# Check the outcome of the response
if ($res->is_success) {
print $res->content;
} else {
print "Unable to retrieve response\n";
}
--
_____________________________________________________________________
Tim Keefer Allen Press, Inc.
Electronic Publishing 1041 New Hampshire
http://www.allenpress.com Lawrence, KS 66044
_____________________________________________________________________
_______________________________________________
handle-dev mailing list
handle-dev@cnri.reston.va.us
http://www.cnri.reston.va.us/mailman/listinfo/handle-dev