contents and try each with node $pos = 0; $n = 0; while (($m = strpos($wevia, "", $m); if ($tag_end === false) break; $tag = substr($wevia, $m, $tag_end - $m + 1); // Skip if has src= if (strpos($tag, "src=") !== false) { $pos = $tag_end + 1; continue; } $end = strpos($wevia, "", $tag_end); if ($end === false) break; $content = substr($wevia, $tag_end + 1, $end - $tag_end - 1); if (strlen($content) < 50) { $pos = $end + 9; continue; } $n++; $abs_line = substr_count(substr($wevia, 0, $tag_end + 1), "\n") + 1; $tmp = "/tmp/wscript-$n.js"; file_put_contents($tmp, $content); $parse = @shell_exec("node --check $tmp 2>&1"); if (trim($parse)) { echo "=== Script #$n (starts abs line $abs_line, " . strlen($content) . "B) ===\n"; echo "$parse\n\n"; } else { echo "Script #$n (line $abs_line, " . strlen($content) . "B): OK\n"; } $pos = $end + 9; }