- file_get_contents: documentation ( source)
- mb_convert_encoding: documentation ( source)
<?php
//差分を見て前回から更新があったかどうか確認
$old_article = file_get_contents('https://i-bitzedge.com/cron/test/test_old.html');
$new_article = file_get_contents('https://i-bitzedge.com/cron/test/test_new.html');
$old_article = mb_convert_encoding($old_article, "SJIS", "UTF-8");
$new_article = mb_convert_encoding($new_article, "SJIS", "UTF-8");
$diff = xdiff_string_diff($old_article, $new_article, 1);
if (is_string($diff)) {
echo "2 つの記事の差分:\n";
echo $diff;
}
?>