in reply to Re: how to upload a file to a secured website?
in thread how to upload a file to a secured website?

Hello SvenXY, Thanks for your reply. is it possible for you to explain bit more in detail or do you have any sample code? i am a newbie to perl and I am still learning things everyday Also this i need to achive using a Perl script and not CGI. Thanks in advance regards Karthik
  • Comment on Re^2: how to upload a file to a secured website?

Replies are listed 'Best First'.
Re^3: how to upload a file to a secured website?
by svenXY (Deacon) on Oct 16, 2007 at 12:59 UTC
    Hi,
    as said, install the two modules mentined above. Then do
    perl -MWWW::Mechanize::Shell -eshell
    You will end up in that shell. Type help for help, then e.g. type connect http://bla.bla to connect to that URL.
    Make your way through the pages (it's a bit like using a text browser). Remember: help is at hand
    When you have what you wanted to do, type
    script myscript
    After quitting the shell (the Mechanize-Shell), you find a file called myscript in your directory that contains the code that will do exactly what you did in the shell. This page should help you.
    update: passing Apache Basic Auth. creditial with WWW::Mechanize? has some information on the auth part of your problem
    Regards,
    svenXY
      I would suggest that you should try simple LWP first and if you realize that the authentication is complex (more than just setting user and password in the standard brower user/password window) to use WWW::Mechanize. Your code should look like this: require LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->proxy('https', 'ftp', 'http://proxy.sn.no:8001/'); $ua->credentials( 'servername:portnumber', 'realm-name', 'username' => 'password' ); Have a look at http://lwp.interglacial.com/ch11_03.htm. If you use Windows, then you may also have issues with the SSL module as it is not always included in the distribution.