I have gotten so close to parse a page that i read from another website, but i have not succeeded i can't get it to get the line to stop breaking at the wrong place. if the number is equal to the rank it should use a line break otherwise keep reading the line.
so i get this :
8 Tony Romo DAL QB 347 550 63.1 34.4 4,483 8.2 280.2 26 Char: 9 Chars2 9 Numb: 9
9 203 36.9 80T 61 17 34 97.6 9 Tom Brady NE QB 371 565 65.7 35.3 4,398 7.8 274.9 28 13 214 37.9 81T 43 12 16 96.2 Char:10 Chars2 10 Numb: 10
instead of this:
8 Tony Romo DAL QB 347 550 63.1 34.4 4,483 8.2 280.2 26 9 203 36.9 80T 61 17 34 97.6 Char: 9 Chars2 9 Numb: 9
9 Tom Brady NE QB 371 565 65.7 35.3 4,398 7.8 274.9 28 13 214 37.9 81T 43 12 16 96.2 Char:10 Chars2 10 Numb: 10
what am i doing wrong?
Code:
<?php
$file = file("[URL unfurl="true"]http://www.nfl.com/stats/categorystats?tabSeq=1&statisticPositionCategory=QUARTERBACK&season=2009&seasonType=REG");[/URL]
$player_count = 1;
foreach ($file as $file_line => $files)
{
$files = strip_tags($files);
$count = $player_count+1;
$chars = htmlspecialchars($files);
$chars2 = explode(",", $chars);
$chars3 = $chars2[0] . $chars2[1];
if($file_line >= 1459)
{
if($chars3 == $count)
{
echo "Char:" . $chars . "Chars2 " . $chars3 . " Numb: " . $count;
echo "<br>";
$player_count++;
}
echo htmlspecialchars($files);
}
}
?>
so i get this :
8 Tony Romo DAL QB 347 550 63.1 34.4 4,483 8.2 280.2 26 Char: 9 Chars2 9 Numb: 9
9 203 36.9 80T 61 17 34 97.6 9 Tom Brady NE QB 371 565 65.7 35.3 4,398 7.8 274.9 28 13 214 37.9 81T 43 12 16 96.2 Char:10 Chars2 10 Numb: 10
instead of this:
8 Tony Romo DAL QB 347 550 63.1 34.4 4,483 8.2 280.2 26 9 203 36.9 80T 61 17 34 97.6 Char: 9 Chars2 9 Numb: 9
9 Tom Brady NE QB 371 565 65.7 35.3 4,398 7.8 274.9 28 13 214 37.9 81T 43 12 16 96.2 Char:10 Chars2 10 Numb: 10
what am i doing wrong?