slloyd has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use HTTP::Headers; use HTTP::Cookies; use HTTP::Request::Common; use LWP::UserAgent; my $file='testfile.txt'; uploadFileToAmazon($file); sub uploadFileToAmazon{ my $file=shift; my $ua = LWP::UserAgent->new; $ua->cookie_jar(HTTP::Cookies->new(autosave => 1 )); $ua->max_redirect(20); push @{ $ua->requests_redirectable }, 'POST'; #First Sign into Amazon SellerCentral account with cookies enabled + so they get passed on my $url='https://sellercentral.amazon.com/gp/sign-in/sign-in.html' +; my %form=( protocol => "https", action => "sign-in", email => $Username, optin => 1, ouid => "01", password => $Password ); my $res=$ua->post( $url,\%form); #then post the file and pass in the info $url='https://sellercentral.amazon.com/gp/upload-download-utils/up +load.html'; my %form=( uploadType => "ShippingConfirmation", uploadFileName =>[$file] ); my $res=$ua->post( $url,'Content-Type' => "multipart/form-data" +,Content=>\%form); #Display the contents of the response return $res->content; }
-------------------------------
Sign up now for a free monthly newsletter service!
http://www.bestgazette.com
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Logon and upload a file to Amazon Seller Central using LWP
by Anonymous Monk on Jan 16, 2009 at 07:23 UTC | |
by slloyd (Hermit) on Jan 16, 2009 at 14:48 UTC | |
|
Re: Logon and upload a file to Amazon Seller Central using LWP
by frieduck (Hermit) on Jan 16, 2009 at 15:10 UTC | |
by slloyd (Hermit) on Jan 16, 2009 at 16:02 UTC | |
by Anonymous Monk on Jan 17, 2009 at 03:07 UTC |