I am attempting to convert some code from TWebBrowser to Chromium but am having trouble figuring out how to send post and header data with an HTTP request.
Below is the TWebBrowser functionality I’m trying to implement.
var
VHeader, PostData: OleVariant;
PostData := VarArrayCreate([0, Length(XMLString) - 1], varByte) ;
HeaderData := 'Content-Type: application/x-www-form-urlencoded'+ '\n';
WebBrowser1.Navigate(StrUrl,EmptyParam,EmptyParam,PostData,VHeader);
How do I do the equivalent with Chromium?
Due to a missing documentation for Delphi Chromium Embedded, I’ll refer the needed requirements for sending web requests for the C++ version of CEF. So, you need to use the
LoadRequestmethod for sending requests in Chromium. For using it, you need the object instance of theCefRequestrequest object class along with theHeaderMapandCefPostDataobjects for request header and data specification.Expanding on Henri Gourvest’s (author of the Delphi CEF wrapper) example from
this thread, you can in Delphi try something like the following pseudo-code:The same should do another version of the above code: