I have this code:
<?php       $html=file_get_contents('testmaker_html.html');
        echo $html;
?>
<script type="text/javascript">
    document.getElementById('save_finaly_TEST').addEventListener("click", function(){
        cover = document.getElementById('cover').value;
        keywords = document.getElementById('keywords').value.split(",");
        notificationAboutElement = "Ok!";
        notifyMe(notificationAboutElement);
      html_saver();
    <?php $test_html = "<script>document.write(html)</script>"?>   
    }); 
</script>
<?php 
        $new_test = rand().".html";
        $myfile = fopen($new_test, "w") or die("Unable to create file!");
        write($myfile, $test_html)  or die("Can't write to file");
        fclose($myfile)  or die("Can't close the file!");
        echo $new_test;
?>
<script type="text/javascript">
    console.log("$test_html: " + <?php echo $test_html; ?>);
    console.log("$new_test: " + <?php echo $new_test; ?>);
</script> 
Why is  $test_html empty? I know the php and javascript is not on same server but this methodd to get values many times worked for many people. Than what can be wrong with this?
 
     
    