Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

Chromium equivalent for a feature using IP*Works component

Post Reply
MiMi
Posts: 6
Joined: Tue Oct 12, 2021 10:30 am

Chromium equivalent for a feature using IP*Works component

Post by MiMi »

Hey
I'm trying to transform a Delphi application that uses TWebBrowser components into a Chromium based one, using CEF4Delphi... of course))
But I'm stuck on a feature that uses that code:

Code: Select all

var
  ipsHTTPS: TipsHTTPS;
begin
...
    ipsHTTPS.UseWinInet := True;
    ipsHTTPS.LocalFile := 'd:\temp\test.pdf';
    ipsHTTPS.ContentType := 'application/x-www-form-urlencoded';
    ipsHTTPS.UserAgent := 'xxx';
    ipsHTTPS.AddCookie('cookieName','cookieValue');
    ipsHTTPS.PostData := 'xxx=yyy'
    ipsHTTPS.URL := 'xxx';
    ipsHTTPS.Action := httpPost;
...
I'd like to have an equivalent for Chromium
I tried to use LoadRequest but I don't know how to set the LocalFile parameter with LoadRequest

Anyone has an idea to help me?

Thanks in advance
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Chromium equivalent for a feature using IP*Works component

Post by salvadordf »

Hi,

The URLRequest demo has all the code you need.

It uses a TCEFUrlRequestClientComponent component to send GET and POST requests and it even shows how to download a PDF file.
MiMi
Posts: 6
Joined: Tue Oct 12, 2021 10:30 am

Re: Chromium equivalent for a feature using IP*Works component

Post by MiMi »

Thanks a lot for your quick answer
I'll have a closer look to that demo
Srry for disturbing :roll:
MiMi
Posts: 6
Joined: Tue Oct 12, 2021 10:30 am

Re: Chromium equivalent for a feature using IP*Works component

Post by MiMi »

It works really well!

For those who might read this post...
TCEFUrlRequestClientComponent component has a DownloadData event, which is fired when receiving the POST request data
And this event can easily store the received data like this:

Code: Select all

procedure TURLRequestFrm.CEFUrlRequestClientComponent1DownloadData(Sender: TObject; const request: ICefUrlRequest; data: Pointer; dataLength: Cardinal);
begin
  if (data <> nil) and (dataLength > 0) then
    FMemStream.WriteBuffer(data^, dataLength);
end;
And then it can be saved to disk

Muchas gracias Salvador)
Post Reply