打印多个网站阵列

Unfortunately, after research I still couldn't find the answer for my issue. The issue is that I cannot print data from multiple pages. Data is printed only once. Perhaps I am missing silly mistake here, which you could help me find it.

$cycles=10;
$listValue=0;


for ($cy = 0; $cy < $cycles; $cy++){

$html = file_get_contents("http://www.website.com/rate/today.aspx?d=02.03.2015&r=". $listValue ."01&c=#");

$dom = new DOMDocument;

@$dom->loadHTML($html);


$tables = $dom->getElementsByTagName('td');
$data = array();


while($table = $tables->item($i++))
{
    //stuff
}

foreach($data as $item) 
{
    echo "Rank - " . $item['rank'] . "</br>";

}

$listValue++;
echo $listValue."<br>";
}

So basically, I am able to print data only of first page.

Declare the collection variable before the first loop $whatWasCollected = "";

Assign the collected data to a variable at the end of the first loop & Append to the variable each time.

$whatWasCollected .= "This is what I want to print..."

Get rid of the last loop and just echo the complete string.

echo $whatWasCollected;

Just a suggestion. Try it out and let me know if it works seem like and interesting question to me.