slloyd has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to logon to my Amazon Seller Central account and upload a Order file. I cannot seem to get the following to work. Any help would be greatly appreciated!
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
    1) Turn on debugging 2) Compare output to that from livehttpheaders 3) adjust your program to mimick livehttpheaders
      How do I turn on debugging in LWP::Useragent so I can see what is going on?
      s/te/ve/
Re: Logon and upload a file to Amazon Seller Central using LWP
by frieduck (Hermit) on Jan 16, 2009 at 15:10 UTC
      I have tried SOAP::Amazon::MerchantTransport but I cannot figure out what URL to post to. I have searched for hours without results.
      s/te/ve/
        Contact amazon?