Advertisement

02.06.2007 at 06:03PM PST, ID: 22152396
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

WINAPI import urlmon, URLDownloadToFile - downloading files with https protocol

Tags: urldownloadtofile
I am tasked with daily downloads of transaction files from within a windows 2000 environment.  In the past, I have used the URLDownloadToFile successfully with the secure websites, but doing so within an ugly VBA macro.  I want desperately to convert all possible from VBA to perl scripts.

Here's the problem.  If the link to the download file is on a page requiring authentication, I'm getting a couple of types of non-zero return codes, all of which seems to point to authentication errors (Access denied) -- it appears the authentication from the open IE browser session isn't being considered when the URLDownloadToFile function is called.  If the file to download is NOT on an authenticated page, the code works fine.  

What am I missing - how can I tie in the authentication when calling URLDownloadToFile from within the perl script?  There seems to be a piece of the puzzle I'm not considering -- so, thanks in advance for any clue as to what I am missing.


Example very simplified code below (w/o actual links and login info), using IEAutomation module to interact with IE.  I have also tried with IE::Mechanize, with the same results.  I am open to other suggestions, however.

#!/usr/bin/perl
use Win32::API;
use Win32::IEAutomation;

my $ie = Win32::IEAutomation->new( visible => 1, maximize => 1);
my $GetUrl = new Win32::API('urlmon', 'URLDownloadToFile', 'NPPNN', 'N');
if(not defined $GetUrl) {
        die "Can't import API urlmon: $!\n";
    }
   
$ie->gotoURL('https://mysecure.download.site');
$ie->getTextBox('name:', "user")->SetValue("User");
$ie->getTextBox('name:', "password")->SetValue("Password");
$ie->getButton('name:', "LogIn")->Click;
$recode = $GetUrl->Call(0, "https://mysecure.download.site/FileIWant.txt", "C:\\SomeFile.txt", 0, 0);
print "Return Code: $recode\n";


Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: elusivecow
Solution Provided By: Adam314
Participating Experts: 2
Solution Grade: A
Views: 9
Translate:
Loading Advertisement...
02.06.2007 at 07:00PM PST, ID: 18482122

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.06.2007 at 07:45PM PST, ID: 18482265

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.06.2007 at 09:31PM PST, ID: 18482634

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.06.2007 at 10:32PM PST, ID: 18483000

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.07.2007 at 07:49AM PST, ID: 18485743

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.10.2007 at 06:02AM PST, ID: 18507055

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.12.2007 at 07:22AM PST, ID: 18515336

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.12.2007 at 08:34AM PST, ID: 18516001

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.12.2007 at 10:05AM PST, ID: 18516843

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.12.2007 at 10:27AM PST, ID: 18517014

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.12.2007 at 12:14PM PST, ID: 18518059

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080236-EE-VQP-29