August 4

track requested URLs in joomla 3.6 by ChatGPT

Simple code to insert into the index.php file (at the top of it) and see in the log the list of domains requested by the website:

// πŸ”₯ HTTP Debug Trap with backtrace
class MyHttpSniffer {
public $context;

function stream_open($path, $mode, $options, &$opened_path) {
$logFile = __DIR__ . '/http-trap.log';
$timestamp = date('c');

// Π—Π°Ρ…ΠΎΠΏΠ»ΡŽΡ”ΠΌΠΎ бСктрСйс
ob_start();
debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
$backtrace = ob_get_clean();

// Π€ΠΎΡ€ΠΌΡƒΡ”ΠΌΠΎ Π»ΠΎΠ³
$logEntry = "[$timestamp] HTTP REQUEST TO: $path\n";
$logEntry .= "Backtrace:\n$backtrace\n";
$logEntry .= str_repeat("-", 80) . "\n";

file_put_contents($logFile, $logEntry, FILE_APPEND);

// НС Π²Ρ–Π΄ΠΊΡ€ΠΈΠ²Π°Ρ”ΠΌΠΎ β€” Π±Π»ΠΎΠΊΡƒΡ”ΠΌΠΎ Π²ΠΈΠΊΠ»ΠΈΠΊ
return false;
}

function stream_stat() {}
function stream_read($count) { return false; }
function stream_eof() { return true; }
function stream_seek($offset, $whence) { return false; }
function stream_tell() { return 0; }
}

@stream_wrapper_unregister("http");
@stream_wrapper_unregister("https");
@stream_wrapper_register("http", "MyHttpSniffer");
@stream_wrapper_register("https", "MyHttpSniffer");

 


Copyright 2021. All rights reserved.

Posted 4 August 2025 by admin in category "simple memo

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.