Files
html/api/ambre-line-dump.php
2026-04-22 01:50:03 +02:00

29 lines
969 B
PHP

<?php
header("Content-Type: application/json");
$wevia = @file_get_contents("/var/www/html/wevia.html");
$pos = 0;
$big = null;
while (($m = strpos($wevia, "<script>", $pos)) !== false) {
$end = strpos($wevia, "</script>", $m);
if ($end === false) break;
$content = substr($wevia, $m + 8, $end - $m - 8);
if (strlen($content) > 20000) { $big = $content; break; }
$pos = $end + 9;
}
if (!$big) { echo json_encode(["error"=>"no big script"]); exit; }
$lines = explode("\n", $big);
// Browser reports line 920 col 105 within that script
$out = [
"total_lines" => count($lines),
"line_918" => $lines[917] ?? "",
"line_919" => $lines[918] ?? "",
"line_920" => $lines[919] ?? "",
"line_921" => $lines[920] ?? "",
"line_922" => $lines[921] ?? "",
"line_920_length" => strlen($lines[919] ?? ""),
"col_95_115_of_920" => substr($lines[919] ?? "", 94, 21),
];
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);