#!/usr/bin/php
<?php
$file = implode("",file("
http://tv.yandex.ru"));
preg_match_all('/(?<=<span class="location">Телеканал ).*(?=<\/span>)/',$file, $matches3);
preg_match_all('/(?<=id=\d\d\d\d\d\d\d\d">)[0-9][:][0-9][0-9]|[0-9][0-9][:][0-9][0-9](?=<\/a>)/',$file, $matches1);
preg_match_all('/(?<=<\/span><span class="summary">).*(?=<\/span><span class="location">)/', $file, $matches2);
for($i=0; $i<count($matches1[0]); $i++)
{
if($matches1[0][$i] <= 9) {$tim = "0".$matches1[0][$i];}
else $tim = $matches1[0][$i];
$text = $text.$tim." - ".$matches3[0][$i]." - ".strip_tags($matches2[0][$i])."\n";
}
//echo $text;
$fil = fopen("scripts/tv.txt","w+");
$fw=fputs($fil,$text);
fclose($fil);
?>