Rewrite the code to use the secureBridge
Posted: Tue 19 Mar 2019 11:57
Hello,
I've bought the SecureBridge so that I could use Https in my application.
I am having difficulties to rewrite a small code where I could use the secureBridge, I am not sure the steps and if the correct component would it be the ScHttpWebRequest, I appreciate a lot your help with my small code:
Retry:= True;
Tries := 0;
while Retry do
begin
HTTPSend.Clear;
PostStr := 'cnpj='+OnlyNumber(ACNPJ)+'&' +
'origem=comprovante&' +
'search_type=cnpj&' +
'submit1=Consultar&' +
'txtTexto_captcha_serpro_gov_br='+Trim(ACaptcha);
WriteStrToStream( HTTPSend.Document, PostStr );
HTTPSend.MimeType := 'application/x-www-form-urlencoded';
HTTPSend.Cookies.Add('flag=1');
HTTPSend.Headers.Add('Referer: https://www.receita.fazenda.gov.br/pess ... tacao3.asp');
HTTPPost('https://www.receita.fazenda.gov.br/pess ... valida.asp');
Retry := (Tries < 2) and
(pos('Captcha Sonoro', RespHTTP.Text) > 0) and
(pos(ACBrStr('Digite o nĂºmero de CNPJ da empresa e clique em'), RespHTTP.Text) > 0);
Inc( Tries );
end;
regards
Alexandre
I've bought the SecureBridge so that I could use Https in my application.
I am having difficulties to rewrite a small code where I could use the secureBridge, I am not sure the steps and if the correct component would it be the ScHttpWebRequest, I appreciate a lot your help with my small code:
Retry:= True;
Tries := 0;
while Retry do
begin
HTTPSend.Clear;
PostStr := 'cnpj='+OnlyNumber(ACNPJ)+'&' +
'origem=comprovante&' +
'search_type=cnpj&' +
'submit1=Consultar&' +
'txtTexto_captcha_serpro_gov_br='+Trim(ACaptcha);
WriteStrToStream( HTTPSend.Document, PostStr );
HTTPSend.MimeType := 'application/x-www-form-urlencoded';
HTTPSend.Cookies.Add('flag=1');
HTTPSend.Headers.Add('Referer: https://www.receita.fazenda.gov.br/pess ... tacao3.asp');
HTTPPost('https://www.receita.fazenda.gov.br/pess ... valida.asp');
Retry := (Tries < 2) and
(pos('Captcha Sonoro', RespHTTP.Text) > 0) and
(pos(ACBrStr('Digite o nĂºmero de CNPJ da empresa e clique em'), RespHTTP.Text) > 0);
Inc( Tries );
end;
regards
Alexandre