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.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

Get body Request.

Post Reply
Djota
Posts: 10
Joined: Fri May 05, 2017 12:35 pm

Get body Request.

Post by Djota »

Hello,
how do I get the body of a request?
Inside this boby is a JSON that you need to search when loading a site.

procedure TForm1.Chromium1ResourceResponse(Sender: TObject;
const browser: ICefBrowser; const frame: ICefFrame;
const request: ICefRequest; const response: ICefResponse;
out Result: Boolean);
var
PostData: ICefPostData;
i: integer;
begin
PostData := request.PostData;
if (PostData <> nil) then
begin
for i := 0 to PostData.GetCount -1 do
begin

end;
end;
end;


I don't know how to convert ICefPostData content to a string.

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

Re: Get body Request.

Post by salvadordf »

If your application makes the request then you can use a TCEFUrlRequestClientComponent component. The URLRequest demo shows how to create the request and get all the data.

If you need to intercept the results of a request then you can use the code in the ResponseFilterBrowser demo.
Djota
Posts: 10
Joined: Fri May 05, 2017 12:35 pm

Re: Get body Request.

Post by Djota »

I couldn't understand the ResponserFilterBrowser example.
What I need is, the page I'm accessing when I click a print button, he makes a request, and in this request he passes a JSON on Post, so I need to get this POST to get this JSON ...
User avatar
salvadordf
Posts: 4565
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Get body Request.

Post by salvadordf »

Sorry, I misunderstood.

Then you need to use the PostInspectorBrowser demo. That demo inspects the POST data in all requests using the TChromium.OnBeforeResourceLoad event.
Post Reply