Home > Back-end >  Have problems, but need to log in using the Delphi download files function after verification to dow
Have problems, but need to log in using the Delphi download files function after verification to dow

Time:11-16

I am using delphi7.0 development, at present there is a demand, I need a specified file via HTTP download, but the file
Direct call DownloadFile (SourceFile, DestFile) this function, there is no session information, automatically redirected to the login screen, not through the verification, file access failure,
Separately in IE browser, login manually copy the address to download the file, but run DELPHI after login daemon, or can't download the file, and file is just a redirect page after, I want to write how to write using DELPHI session session, I was able to get to that file,

Uses URLMon ShellApi;
The function DownloadFile (SourceFile, DestFile: string) : Boolean;
The begin
Try
Result:=UrlDownloadToFile (nil, PChar (SourceFile), PChar (DestFile), 0, nil)=0.
Except,
Result:=False;
end;
end;

Procedure TForm1. For. Click (Sender: TObject);
Const
//URL Location
SourceFile:='http://www.google.com/intl/de/images/home_title.gif';
//the Where to save the file
DestFile:='c: \ temp \ Google - image. GIF';
The begin
If DownloadFile (SourceFile DestFile) then
The begin
ShowMessage (' Download succesful! ');
//Show downloaded image in your browser
ShellExecute (Application. Handle, PChar (' open '), PChar (DestFile), PChar (' '), nil, SW_NORMAL)
End
The else
ShowMessage (' Error while downloading '+ SourceFile)
end;

CodePudding user response:

With httpdebug caught, first under the ie, from login to download operation time, analyse, login and download the message, Delphi side indy was used to simulate the can

CodePudding user response:

Can you specifically, did not make the httpdebug with built-in or download a

CodePudding user response:

reference 1st floor xsl510079027 response:
with httpdebug caught, first under the ie, from login to download operation time, analyse, login and download the message, Delphi here in indy analog switch


Can you specifically, or give a QQ, I contact you

CodePudding user response:

Download the HTTP Debugger Pro software, can analyze the login request specific message,