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

I am trying to save images from the web. I know there are several modules out there that have this functionality, but my case is uniquie since it requires a secure connection. I have succesfully downloaded pages and images using cpan.org modules from unsecured websites, but never from any https sites.

I can use the Internet Explorer OLE automation to login to the site and navigate, but the execWB mehod does not work for saving anything. I've spent many hours searching for answers and the closest I cam was a thread about using Msxml2.XMLHTTP to save the image, but I was unable to get this to work. Are there any other suggestions?

thanks,
Kevin

Replies are listed 'Best First'.
Re: save http image data
by marto (Cardinal) on Oct 09, 2005 at 22:52 UTC
      Thanks! The last version I used of WWW::Mechanize would not work, but this new version seems to do the trick.

      I still have one problem. The site I am attempting to access has as a javascript driven login script. I have a sort of hack solution to this by continuing to use follow_link method until I get a page that seems like the home page. Thee must be a way to automate this process and have the mechanize routine follow redirects until there is no more data to fetch. How can I accomplish this?

      thanks,
      Kevin
Re: save http image data
by kcella (Beadle) on Oct 10, 2005 at 22:33 UTC
    I found another issue with WWW::Mechanize. It does not handle Javascript. There are several links on the site I am trying to browse and they need use Javascript variables defined on the client window object. I was able to access this information easily with Win32::OLE and InternetExplorer.Application since it had that support and used a DOM parser. Is there some way to access the client window and extract the variable data?
      Hi kcella,

      Sorry it took me so long to reply.
      Have you had a look at Win32::IE::Mechanize?
      "This module tries to be a sort of drop-in replacement for WWW::Mechanize. It uses Win32::OLE to manipulate the Internet Explorer."

      I think you should have a read at the documentation for this module, it may be the answer to your problem.

      Martin
        Yes. Actually I was already using Win32::OLE before with IE, but there was no way to save image data without having it being interactive.

        It looks like I will have to use WWW::Mechanize to save data and then use IE::Mechanize for any javascript I need to handle. I was just hoping for a cleaner way to handle the save functionality.

        Thanks for all the help, at least I now have some modules I can use that help make my code more concise.

        thanks,
        Kevin