How do I submit a post - a request to chromium embedded?

Showing 1-3 of 3 messages
How do I submit a post - a request to chromium embedded? AUsatov 5/24/11 2:31 AM
Hi,

Help send a post request to the site.
Through TWebBrowser I do so:
var EncodedDataString,sTemp:string; PostData: OleVariant; Headers:
OleVariant; i:integer;
begin
    EncodedDataString:='st.posted=set&'+
                       'st.email='+HTTPEncode('login')+'&'+
                       'st.password='+HTTPEncode('xxxx')+'&'+
                       'button_go='+HTTPEncode('Enter');
    PostData:=VarArrayCreate([0,length(EncodedDataString)-1],varByte);
    //Now, move the Ordinal value of the character into the PostData
array
    for i:=1 to Length(EncodedDataString) do
      PostData[i-1]:=ord(EncodedDataString[i]);
    Headers:='Content-type: application/x-www-form-urlencoded'#10#13;
    //Parameters 2 and 3 are not used, thus EmptyParam is passed.
    sTemp:=GetPostLink(False,'class="panelBox_body"><form
action="','"');
 
Webbrowser1.Navigate(sTemp,EmptyParam,EmptyParam,PostData,Headers);
end;

How can I make this request by using chromium embedded?

Thank you!
Re: How do I submit a post - a request to chromium embedded? Henri Gourvest 5/24/11 5:25 AM
function CreateField(const str: AnsiString): ICefPostDataElement;
begin
  Result := TCefPostDataElementRef.New;
  Result.SetToBytes(Length(str), PAnsiChar(str));
end;

var
  req: ICefRequest;
  data: ICefPostData;
begin
  req := TCefRequestRef.New;
  req.Url := 'http://somewhere';
  req.Method := 'POST';
  req.Flags := WUR_FLAG_NONE;
  data := TCefPostDataRef.New;
  data.AddElement(CreateField('data.id=27'));
  data.AddElement(CreateField('&data.title=title'));
  data.AddElement(CreateField('&data.body=body'));
  req.PostData := data;
  crm.Browser.MainFrame.LoadRequest(req);
end;


2011/5/24 AUsatov <demo...@gmail.com>



--
Henri Gourvest
Re: How do I submit a post - a request to chromium embedded? Daniel Hudi 12/31/14 3:46 AM
"Error] Unit1.pas(58): Undeclared identifier: 'WUR_FLAG_NONE'"

2011. május 24., kedd 14:25:00 UTC+2 időpontban Henri Gourvest a következőt írta: