Kod
<?php
function a_filtr_one($text){
$text = str_replace ('<td class="t2">', '<td class="t">', $text);
$text = str_replace ('<td class="c2">', '<td class="c">', $text);
return $text;
}
function filtr($text){
$text = str_replace ('<td class="t">', '', $text);
$text = str_replace ('<td class="c">', '', $text);
$text = str_replace ('</td>', '', $text);
$text = str_replace ('<em>', '', $text);
$text = str_replace ('</em>', '', $text);
return $text;
}
function program_tv($program){
$day = date(Y-m-t);
$page = implode ('', file ('http://programtelewizji.pl/'.$program.'/'.$day.'/'));
$page = a_filtr_one($page);
preg_match_all('/<td class="t">.*?<\/td>/s', $page, $m);
foreach($m AS $key => $value)
{
$godz = $value;
}
preg_match_all('/<td class="c"><em>.*?<\/em>/s', $page, $m);
foreach($m AS $key => $value)
{
$prog = $value;
}
$x = count($godz);
$i = 0;
while($i < $x){
$a = filtr($godz[$i]);
$b = filtr($prog[$i]);
$return = "$return | $a - $b";
//echo "".filtr($godz[$i])." - ".filtr($prog[$i])." <br>\n";
$i++;
}
return $return;
}
// np.
echo program_tv("TVN");
?>
otrzymałem ten kod od UW-Team.org
ale mam problem z kodowaniem bo
http://programtelewizji.pl ma kodowanie
Kod
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
a Ja na swojej stronie mam
Kod
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
jest "Podróşe z Ĺźartem" zamiast "Podróże z żartem" ;/
da się jakoś ustawić ze wyciągane dane są poprawnie kodowane?