That was quite a tricky one. But somehow I managed to get what you wanted by reading the textfile line by line:
$phile="http://www.urdomain.com/text.txt";
$text=file($phile);
for ($i=0; $i<count($text); $i++)
{
switch($i)
{
case 0:
$t=explode(' ',$text[$i]);
$finaltext=$t[0].' , '.$t[1].' , ';
break;
case 1:
$finaltext.=$text[$i].' | ';
break;
case 2:
$finaltext.=$text[$i].'<br>';
break;
case 4:
$t=explode(' ',$text[$i]);
$finaltext.=$t[0].' , '.$t[1].' , ';
break;
case 5:
$finaltext.=$text[$i].'<br>';
break;
case 7:
$t=explode(' ',$text[$i]);
$finaltext.=$t[0].' , '.$t[1].' ';
break;
case 9:
$finaltext.=$text[$i];
break;
}
}
echo $finaltext;
This little script assumes that you have the textfile just the way you said it is(Empty lines etc.).