sagar
sagar

Reputation: 1936

How to capture GET/POST request made from MFC web browser c++

I have MFC application which is basically web browser. I have used CHTMLView class for that. On executing app, it will navigate to some default web page. On that page there are some buttons. On clicking any button will generate GET/POST requests. I want to capture those GET/POST request and its responses. Also I have to make sure that responses that browser is getting is from valid source.

Following webpage is similar to the page I am working on support.google.com/books/partner/answer/3254227?hl=en On this web page there is 'Yes' & 'No' button. On clicking on any of those buttons, it sends some POST/GET request

Upvotes: 3

Views: 814

Answers (1)

MSalters
MSalters

Reputation: 180145

CHTMLViewer wraps an IWebBrowser2. The useful parts are wrapped. In this case, you want the CHtmlView::OnBeforeNavigate2 callback. It's called with the GET or POST request.

If you don't trust the URL (i.e. not a valid source), you can use the last cancel parameter in OnBeforeNavigate2 to stop the GET or POST.

Upvotes: 2

Related Questions