Category Archives: Uncategorized

Use cURL to authenticate with JWT Bearer tokens

Example to pass the Bearer token in the Authorization header: curl -H ‘Accept: application/json’ -H "Authorization: Bearer ${TOKEN}" -H ‘Accept: application/json’ -H "Authorization: Bearer ${TOKEN}" If you need to get the Bearer token use this: curl -s -X POST -H ‘Accept: application/json’ -H ‘Content-Type: application/json’ –data ‘{"username":"{username}","password":"{password}"}’ -s -X POST -H ‘Accept: […]

Parse or Split FTP URL in Delphi XE using TIdURI

Given an FTP URL, you can parse it using TidURI: uses … IdFTP, IdFTPCommon, IdURI …   procedure TForm1.btnDownloadFileClick(Sender: TObject); var URL: string; Uri: TIdURI; begin URL := Trim(edURL.Text); Uri := TIdURI.Create(URL);   try IdFTP1.Host := Uri.Host;   if Uri.Port <> ” then IdFTP1.Port := StrToInt(Uri.Port) else IdFTP1.Port := 21;   IdFTP1.ConnectTimeout := 5000;   […]

How to Download a File via FTP in Delphi XE

A quick example to download a fila via FTP using Indy (IdFTP): uses … IdFTP, IdFTPCommon …   procedure TForm1.Button1Click(Sender: TObject); begin IdFTP1.Host := ‘’; IdFTP1.Port := 21; IdFTP1.ConnectTimeout := 5000; IdFTP1.Username := ‘demo’; IdFTP1.Password := ‘password’; IdFTP1.TransferType := IdFTPCommon.TIdFTPTransferType.ftBinary; IdFTP1.Passive := True;   try IdFTP1.Connect; try IdFTP1.Get(‘/pub/example/pop3-browser.png’, ExtractFilePath(ParamStr(0)) + ‘pop3-browser.png’, True, False); finally IdFTP1.Disconnect; […]

Zendesk Remove [Business Name] from Email Subject on Ticket Replies

Browse to Admin->Business Rules->Triggers Edit the trigger named “Notify requester and CCs of comment update” In the Actions -> Email Subject you should have: [{{ticket.account}}] Re: {{ticket.title}}[{{ticket.account}}] Re: {{ticket.title}} Just remove [{{ticket.account}}] Then save, that’s it!

Double Opt-in Email Newsletter Made Right (by Yoast)

1) The “Subscribe to Newsletter” call-to-action: 2) The “Wait for Confirmation Email” web page: 3) The “Confirm Your Subscription” email message: 4) The “Thank You for Subscribing” web page:

Delphi URLEncode like PHP

Example URLEncode() function converted from PHP to Delphi: function URLEncode(const aData: AnsiString): AnsiString; const Chars: Array [0..18] of AnsiChar = (#$25, #$21, #$2A, #$27, #$28, #$29, #$3B, #$3A, #$40, #$26, #$3D, #$2B, #$24, #$2C, #$2F, #$3F, #$23, #$5B, #$5D); var sData: String; i1: DWORD; begin sData := String(aData); for i1 := Low(Chars) to High(Chars) do […]

Make Your Domain Emails Not Spoofeable

Simple steps to make your domain emails not spoofeable: 1) Add a TXT record (SPF): v=spf1 a mx ~allv=spf1 a mx ~all Or use include: to include specific hosts or IPs, example: v=spf1 include:ip4: ~allv=spf1 include:ip4: ~all 2) Add a TXT record (DMARC): v=DMARC1; p=quarantine; pct=100;; ruf=mailto:support@yourdomain.comv=DMARC1; p=quarantine; pct=100;; Or […]

Example PHP Script to Receive and Return JSON Data

Here is an example PHP script used to receive and return JSON data: @header(‘Content-Type: application/json; charset=utf-8’);   $json = file_get_contents(‘php://input’);   $array = json_decode($json, true);   $username = $array[‘username’];   $password = $array[‘password’];   $result = array();   $result[‘status’] = "OK";   echo json_encode($result);@header(‘Content-Type: application/json; charset=utf-8’); $json = file_get_contents(‘php://input’); $array = json_decode($json, true); $username = […]

Delphi HTTP POST JSON Example

Here is an example to POST JSON data with Delphi 10: Reference: Add these libraries in your uses: idSSLopenSSL, idHttp, JsonidSSLopenSSL, idHttp, Json Here is the example code to POST JSON data: procedure TForm1.Button1Click(Sender: TObject); var JsonStr: string; sResponse: string; JsonToSend: TStringStream; HTTP1: TidHTTP; F: TJSONObject; begin Button1.Enabled := False; memoResponse.Lines.Clear; memoRequest.Lines.Clear;   F […]