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");