Website is a mirror. How to detect this programmatically in php?

292 Views Asked by At

For example I have 4g-market.ru But it is a mirror for peterhost.ru. How I can detect this programmatically?

2

There are 2 best solutions below

0
On BEST ANSWER

This function detects only a single-bounce redirect (site1 -> site2, not site1 -> site3 -> site2):

function isRedirect($url)
{
  $headers = get_headers($url, true);

  $status = $headers[0];
  list($protocol, $code, $message) = split(' ', $status, 3);

  return ($code >= 300 && $code < 400);
}
0
On

you might find this paper useful http://www2007.org/papers/paper194.pdf it is about similar website and different URL. It take some heuristic approach to analysing a specific web url and predicting it similarity.