JSFiddle - React, Tailwind, and code Playground
HTML
<html>
<head>
<title>HTML to PHP</title>
</head>
<body>
<script>
function getPageHTML()
{
//Get the HTML and add to a form element before submitting the form.
document.PageContent.HTML.value=document.all[0].innerHTML;
document.PageContent.submit();
}
</script>
This page has some JavaScript that gets the HTML content and passes to a PHP page where you can read it from a $_POST command.
<br>
<br>
<input type="button" value="Get HTML" onclick="getPageHTML();">
<!-- form used to hold HTML content and post to another page -->
<form name="PageContent" method="post" action="HTMLtoPHP.php">
<input type="hidden" name="HTML">
</form>
</body>
</html>