<?php
header('Access-Control-Allow-Origin: http://192.168.178.22:8082');

$html = file_get_contents('http://192.168.178.21/log/push_record.log');
$html2 = file_get_contents('mdstate.php');
$pdfHtml = 'mdstate.php';
$pdfHtml2 = 'mdstate2.php';

if ($html===$html2){
	file_put_contents($pdfHtml2, "<?php header('Access-Control-Allow-Origin: http://192.168.178.22:8082'); ?>");
	file_put_contents($pdfHtml2, "no", FILE_APPEND);
	echo "keine aenderung";
}

if (($html!==$html2) && (!empty($html))){
	file_put_contents($pdfHtml2, "<?php header('Access-Control-Allow-Origin: http://192.168.178.22:8082'); ?>");
	file_put_contents($pdfHtml2, "yes", FILE_APPEND);
	file_put_contents($pdfHtml, $html);
	echo "geaendert!";
}
if (($html!==$html2) && (empty($html))){
	file_put_contents($pdfHtml2, "<?php header('Access-Control-Allow-Origin: http://192.168.178.22:8082'); ?>");
	file_put_contents($pdfHtml2, "no", FILE_APPEND);
	echo "keine aenderung";

}
/*
$laenge = strlen($html)-1;
$new_string=substr($html,50,$laenge);
$new = substr($html,0,0).'<pre style="word-wrap: break-word; white-space: pre-wrap;">'.substr($html,0,$laenge);





$pdfHtml = 'mdstate.php';
 file_put_contents($pdfHtml, "<?php header('Access-Control-Allow-Origin: http://192.168.178.22:8082'); ?>");
 file_put_contents($pdfHtml, $new, FILE_APPEND);


        // Now you can choose to run a check to see if the new copy exists,
        // or you have the option to do nothing and assume it is made
        if (file_exists($pdfHtml)) {
            echo "Success :  has been made";
        } else {
            echo "Failure:  does not exist";
        }
*/
?>
