Category Archives: Uncategorized

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: https://stackoverflow.com/a/24042633 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 […]

How to Send (POST) JSON Data with PHP cURL

Example PHP code to send (via HTTP POST) JSON data to an URL: $data = array( "username" => "admin", "password" => "password", );   $curl = curl_init("https://api.website.com/v1/auth/login/"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLINFO_HEADER_OUT, 1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($curl, CURLOPT_HTTPHEADER, array(‘Content-Type: application/json’); $output = curl_exec($curl); curl_close($curl);   print_r(json_decode($output));$data = array( "username" => "admin", "password" […]

PCRE Fnmatch() PHP Function for Wildcard String Match

PHP function fnmatch() has 4096 characters limit: Warning: fnmatch(): Filename exceeds the maximum allowed length of 4096 charactersWarning: fnmatch(): Filename exceeds the maximum allowed length of 4096 characters To avoid these limits we can use a PCRE-like fnmatch() function: https://www.php.net/manual/en/function.fnmatch.php#100207 Here is a modified PHP code found in the php.net website: if (!function_exists(‘fnmatch’)) { define(‘FNM_PATHNAME’, […]

Delphi XE Add Icons and Images as Resources

First Click on Project -> Resources and Images: Then just click on “Add” to add an icon or image: For icons, make sure to use all UPPERCASE characters. Here is an example to use a icon resource in the trayicon: procedure TForm1.Button4Click(Sender: TObject); begin TrayIcon1.Visible := False; TrayIcon1.Icon.LoadFromResourceName(hInstance, ‘ICON1’); TrayIcon1.Visible := True; end;procedure TForm1.Button4Click(Sender: TObject); […]

Delphi XE Change System Tray Icon with TTrayIcon (No Blurry)

You can change system tray icon by using TTrayIcon and TImageList: procedure TForm1.Button4Click(Sender: TObject); begin TrayIcon1.IconIndex := 0; end;   procedure TForm1.Button5Click(Sender: TObject); begin TrayIcon1.IconIndex := 1; end;procedure TForm1.Button4Click(Sender: TObject); begin TrayIcon1.IconIndex := 0; end; procedure TForm1.Button5Click(Sender: TObject); begin TrayIcon1.IconIndex := 1; end; However this seems to add a blurry effect on the icon (not […]

Install Latest NVIDIA Drivers for Windows 10

Open this URL in your browser: https://www.nvidia.com/Download/index.aspx?lang=en-us Enter your NVIDIA graphic card details and click the Search button. BONUS TIP: If you are a creative or business and not a gamer, select: Download Type = Studio Driver (SD) These drivers focuses on stability and wuality.

Download Old Sent Emails on POP Account with Thunderbird

POP mail accounts can only access and download inbox messages. However you can use a smart workaround to download also old sent messages, in short what you can do is create a new IMAP mail account, download the sent emails there, then select all sent emails, copy them to the POP mail account’s sent folder, […]

Artillery Sidewinder X1 3D Printer

I was looking for a good 3D printer in terms of quality and price and I found this Artillery Sidewinder X1 3D Printer. Looks like to be new (year 2020) and very popular among 3D printer geeks, so here is an image of the printer: You will need also these items: Creality 3D® PLA Filament […]

Share Buttons for Facebook, Twitter and LinkedIn

I was looking for PNG images of Facebook, Twitter and LinkedIn share buttons to use with A HREF links (I didn’t want to use Javascript or third-parties code). Here you can find PNG images for Facebook, Twitter, LinkedIn share buttons. To download them just right-click on the image and select “Save Image As…” Feel free […]