PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $logFile = "NP 0 00:01:07.533 Trade-ForexEmpire (XAUUSD,H1) 1795780768 message 4710: 2024-08-05 07:01:06+00:00 😠Gold Sell 2429/2428 | | | TP1. 2424 | TP2. 2420 | TP3. 2415 | | | SL . 2436 LJ 0 00:01:07.638 TradeSynchronizer (XAUUSD,H1) Position Opened: 4470550 RR 0 00:01:07.638 TradeSynchronizer (XAUUSD,H1) "Sendin"g & Updating the position on the server FO 0 00:01:07.640 Trade-ForexEmpire (XAUUSD,H1) Order was opened: #4470550 Sell 0.30 XAUUSD at 2428.96 sl: 2436.00 tp: 2424.60 MS 0 00:01:07.642 TradeSynchronizer (XAUUSD,H1) Trade sent to the server "; // Path to the log file // Check if the file exists if (!file_exists($logFile)) { die("File not found."); } // Open the file for reading $file = fopen($logFile, 'r'); if ($file) { $found = false; // Flag to track if any matching lines are found // Loop through each line in the file while (($line = fgets($file)) !== false) { // Clean the line by removing quotes and special characters $cleanLine = str_replace(["'", "\""], "", $line); // Check if the cleaned line contains the word "TradeSynchronizer" if (stripos($cleanLine, 'TradeSynchronizer') !== false) { // Remove single and double quotes from the line for displaying $line = str_replace(["'", "\""], "", $line); // Print the cleaned line echo htmlspecialchars($line) . "<br>"; $found = true; // Set the flag to true if a match is found } } // Close the file fclose($file); // Check if no matching lines were found if (!$found) { echo "No results"; } } else { die("Error opening the file."); }
Show:  
Copy Clear