Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 11/11/18 in all areas

  1. Kryvich

    How To HTTP POST in Delphi?

    Thanks to @Arnaud Bouchez for his great framework mORMot. It makes complicated things simple.
  2. Mr. E

    How To HTTP POST in Delphi?

    @Kryvich THANK YOU! (I'm screaming, Yes!) This is like seeing a sunrise and wondering how it's this possible? 🌞 I'm reading your code, is slick and to the point. This isn't trivial for anyone without previous knowledge, I need a lot of theory to learn (web, sockets, mORMot, etc.) -- How can I mark the post as solved (with a lot to read/learn) ?
  3. Kryvich

    How To HTTP POST in Delphi?

    Each of us was in such a situation. See, this is a ready-made working example. You can use it as a basis: program TestPostRequest; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, SynCrtSock; const RequestHeaderTemplate = 'SOAPAction: http://tempuri.org/IConsultaCFDIService/Consulta'; RequestDataTemplate = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">' + ' <soapenv:Header/>' + ' <soapenv:Body>' + ' <tem:Consulta>' + ' <!--Optional:-->' + ' <tem:expresionImpresa><![CDATA[%expresionImpresa%]]></tem:expresionImpresa>' + ' </tem:Consulta>' + ' </soapenv:Body>' + '</soapenv:Envelope>'; function SendCommand(Request: THttpRequest; const ExpresionImpresa: string): SockString; var outHeaders: SockString; begin Result := ''; try Request.Request('ConsultaCFDIService.svc?wsdl', 'POST', 20000, RequestHeaderTemplate, SockString(StringReplace(RequestDataTemplate, '%expresionImpresa%', ExpresionImpresa, [])), 'text/xml;charset="utf-8"', outHeaders, Result); except on E: Exception do begin Writeln('Error: ', E.Message); Exit; end; end; end; var Request: THttpRequest; Answer: SockString; begin try Request := TWinHTTP.Create('consultaqr.facturaelectronica.sat.gob.mx', '', True); try Answer := SendCommand(Request, '?re=LSO1306189R5&rr=GACJ940911ASA&tt=4999.99&id=e7df3047-f8de-425d-b469-37abe5b4dabb'); Writeln('Answer:'); Writeln('----------------'); Writeln(Answer); Writeln('----------------'); // Next requests go here ... finally Request.Free; end; Writeln('Press Enter to continue.'); Readln; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end.
  4. Uwe Raabe

    fast file searching, what do you recommend, please?

    TDirectory.GetFiles/GetDirectories/GetFileSystemEntries have overloads taking a TFilterPredicate. You can provide your own accept function with that. The following example lists all dll and exe files from the given folder in one go. files := TDirectory.GetFiles('C:\Temp\', function(const Path: string; const SearchRec: TSearchRec): Boolean begin Result := TPath.MatchesPattern(SearchRec.Name, '*.exe') or TPath.MatchesPattern(SearchRec.Name, '*.dll'); end);
  5. More info here: http://community.idera.com/developer-tools/b/blog/posts/new-in-rad-studio-10-3-options-dialog-improvements
  6. Stefan Glienke

    New in 10.3: IDE UI Improvements in the Main Window

    It will not get them more customers just because it's 64bit and runs out of memory later because all the instabilities and the compiler getting into a bad state because of compile errors or what not crashing the IDE will still be there as will the poor code tooling. Going the easy/cheap way every time is what puts Delphi and the IDE into the current situation of constantly having to react to external factors and tinker around edges. Sometimes I really have a hard time believing that or you just avoid certain features or have subconsciously developed a certain habit to do things differently. Or you just use it to prepare demos.
×