Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Logon and upload a file to Amazon Seller Central using LWP

by slloyd (Hermit)
on Jan 16, 2009 at 06:10 UTC ( [id://736742]=perlquestion: print w/replies, xml ) Need Help??

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?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://736742]
Approved by ikegami
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-04-19 19:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found