检索网站html,但代码运行两次

I have this code, and whenever it runs, it executes twice. This is a problem, because i need to display this information for a user.

I am somewhat not familiar with arrays that much, and therefore i'd like your expertise on the subject.

My code is as follows:

$wwwLink = "http://agynix.com/";
$IMEIapproved = false;
$data = file_get_contents($wwwLink);
//In the pattern the "class" is the div class, and the "div-res" is the value of the class
$pattern = '%<div\b[^>]*?\bclass\s*+=\s*+([\'"]?+)\bdiv-res\b(?(1)\1)[^>]*+>((?:[^<]++|<(?!/?div\b|!--)|<!--.*?-->|<div\b[^>]*+>(?2)</div\s*>)*+)</div\s*>%isx';
$matchcount = preg_match_all($pattern, $data, $matches);
if ($matchcount > 0) {
    print_r($matches);
}
else {
    echo "Holy shit! Back to the drawing board";
}

My question is; how do i make this code only retrieve the information once? Is it the echo/print_r, is it the array information, is it the pattern, or is it my incompetence?

I'm not sure if it helps, but... Do you know that preg_match_all puts into $matches[0] strings that matched the whole expression and into $mathches[1] - strings that matched first parenthesized subexpression?.