I want to get the result of shown JavaScript and HTML code. For example, when we write document.write("Hello"), return "Hello".
Look at this code:
$html_code = <<<EOL
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hello World</title>
</head>
<body>
<script>
document.write("Hello World");
</script>
</body>
</html>
EOL;
$result = getResult($html_code);
echo $result;
I want to get this result:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hello World</title>
</head>
<body>
Hello World
</body>
</html>