(.*)@imsU', $c1, $matches1);
unset($c1);
$c2 = file_get_contents($url2);
preg_match_all('@(.*)@imsU', $c2, $matches2);
unset($c2);
foreach($matches1[1] AS $rating) {
preg_match('@(.+)@imsU', $rating, $matchA);
preg_match('@(.+)@imsU', $rating, $matchB);
$ratings[$matchA[1]][$name1] = $matchB[1];
if (preg_match('@(.+)@imsU', $rating, $urlmatch)) {
$ids[$matchA[1]] = $urlmatch[1];
}
}
unset($matches1);
foreach($matches2[1] AS $rating) {
preg_match('@(.+)@imsU', $rating, $matchA);
preg_match('@(.+)@imsU', $rating, $matchB);
$ratings[$matchA[1]][$name2] = $matchB[1];
if (preg_match('@(.+)@imsU', $rating, $urlmatch)) {
$ids[$matchA[1]] = $urlmatch[1];
}
}
unset($matches2);
$diff = array();
$only1 = array();
$only2 = array();
foreach($ratings AS $id => $rating) {
$_diff = abs($rating[$name1] - $rating[$name2]);
$out = '' . $id . ' (' . basename($ids[$id]) . ')
';
if ($rating[$name1] >= $rating[$name2]) {
$out .= '' . $name1 . ': ' . $rating[$name1] . '
';
} else {
$out .= $name1 . ': ' . $rating[$name1] . '
';
}
if ($rating[$name1] <= $rating[$name2]) {
$out .= '' . $name2 . ': ' . $rating[$name2] . '
';
} else {
$out .= $name2 . ': ' . $rating[$name2] . '
';
}
if (empty($rating[$name1])) {
$only2[] = $out;
} elseif (empty($rating[$name2])) {
$only1[] = $out;
} else {
$diff[$_diff][] = $out;
}
}
echo '
Differences
';
krsort($diff);
foreach($diff AS $_diff => $outs) {
echo 'Difference of ' . $_diff . '
';
echo implode('
', $outs);
}
echo 'Only rated by ' . $name1 . '
';
echo implode('
', $only1);
echo 'Only rated by ' . $name2 . '
';
echo implode('
', $only2);