..:: slovenska php stran ::..
uporabniško ime:
geslo:
- napiši
- arhiv
- sveže
- napiši
- arhiv
- Spletni ko...
- MySql Iska...
- Preprosta ...
- PHP - dina...
- Google - i...
- Števec obi...
- PHP - krat...
- PHP in MYS...
- mail skrip...
- prva stran
- e: lazo@php-si.com
- izmenjava pasic
- pozabili geslo
Pikslar.com
Smrkec.com - Mnogo stvari na enem mestu
www.matjazev.net
slo-site.com
100si
stran: [1]
sebastijan
član

št. sporočil: 23
datum: 04.04.2006 | čas: 22:44

Pop TV:


Koda:

<?php
header("Content-type: text/html; charset=iso-8859-2");
$stran = file_get_contents("http://24ur.com/spored/poptv_".mktime(0, 0, 0, date("m", time()), date("d", time()), date("Y", time())).".php");
preg_match_all("/<span class=\"tv_clock\">(.*)<\/span>[\s]+<span class=\"tv_prog_content\">[\s]+<span class=\"tv_prog_title tv__linkblue\">(<a href=\"(.*)\" >(.*)<\/a>|(.*))<\/span>[\s]+<br \/>(.*)[\s]+<\/span>/", $stran, $izpis, PREG_SET_ORDER);
foreach ($izpis as $spored) {
$cas = explode(":",$spored[1]);
print ((strlen($cas[0]) == 1)?"0".$cas[0].":".$cas[1]:$cas[0].":".$cas[1])." - ".((empty($spored[4]))?trim($spored[5]):"<a href=\"http://24ur.com$spored[3]\">".trim($spored[4])."</a>")."<br>";
}
?>




Kanal A:


Koda:

<?php
header("Content-type: text/html; charset=iso-8859-2");
$stran = file_get_contents("http://24ur.com/spored/kanala_".mktime(0, 0, 0, date("m", time()), date("d", time()), date("Y", time())).".php");
preg_match_all("/<span class=\"tv_clock\">(.*)<\/span>[\s]+<span class=\"tv_prog_content\">[\s]+<span class=\"tv_prog_title tv__linkorange\">(<a href=\"(.*)\" >(.*)<\/a>|(.*))<\/span>[\s]+<br \/>(.*)[\s]+<\/span>/", $stran, $izpis, PREG_SET_ORDER);
foreach ($izpis as $spored) {
$cas = explode(":",$spored[1]);
print ((strlen($cas[0]) == 1)?"0".$cas[0].":".$cas[1]:$cas[0].":".$cas[1])." - ".((empty($spored[4]))?trim($spored[5]):"<a href=\"http://24ur.com$spored[3]\">".trim($spored[4])."</a>")."<br>";
}
?>






Sebastijan Bauman
sebastijan
član

št. sporočil: 23
datum: 05.04.2006 | čas: 00:16

RTV Slo (TV Slovenija 1 = 1; TV Slovenija 2 = 2; A1 = 3; VAL 202 = 4; ARS = 5):



Koda:

<?php
define("RTV_SPORED", 5);
header("Content-type: text/html; charset=iso-8859-2");
$stran = file_get_contents("http://www.rtvslo.si/modload.php?&c_mod=rspored-v2&izbran_dan=".date("Y-m-d", time())."&izbran_program=".RTV_SPORED."&s_content=xml");
preg_match_all("/<ura>(.*)<\/ura>[\s]+<naslov>(.*)<\/naslov>/", $stran, $izpis, PREG_SET_ORDER);
foreach ($izpis as $spored) {
print $spored[1]." - ".$spored[2]."<br>";
}
?>




sporočilo je spremenil sebastijan [05.04.2006 ob 00:22]

Sebastijan Bauman
MrM
član

št. sporočil: 2080
datum: 05.04.2006 | čas: 07:29

Dokaj uporabni "code snippet" (dokler RTV ne spremeni HTMLja ). Ne bi pa škodilo, če bi bila koda malenkost bolj pregledna .



God is real, unless declared integer.
sebastijan
član

št. sporočil: 23
datum: 05.04.2006 | čas: 08:04

Naredi pregledneje MrM. Zato sem objavil.



Sebastijan Bauman
fREDi
član

št. sporočil: 960
datum: 05.04.2006 | čas: 08:17

se moja koda ki jo uporabljam

Koda:

<html>
<head>
<title>TV Spored - bY CrazY`A|</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
div
{
   border: 1px solid #000000;
   font-family: verdana;
   font-size: 12px;
}
body
{
   background-color: #E5F5FF;
   font-family: verdana;
   font-size: 12px;
}
img
{
   border: 0px;
}
div
{
   border: 0px;
}
</style>
<script language="Javascript">
var divs = new Array('tvs1', 'tvs2', 'kanala', 'poptv', 'discovery');
function toggle_view(item_id){
   for(x=0;x<divs.length;x++)
   {
      a= document.getElementById(divs[x]);
      if (a)
      {
         if(divs[x] == item_id)
         {
            if (a.style.display=='')
               a.style.display= 'none';
            else
               a.style.display= '';
         }
         else
            a.style.display= 'none';
      }
   }
}
</script>
</head>

<body>
<a href="javascript:toggle_view('tvs1');" title="TVS 1"><img src="tvs1.gif" alt="TVS 1" /></a>&nbsp;&nbsp;&nbsp;
<a href="javascript:toggle_view('tvs2');" title="TVS 2"><img src="tvs2.gif" alt="TVS 2" /></a>&nbsp;&nbsp;&nbsp;
<a href="javascript:toggle_view('kanala');" title="Kanal A"><img src="kanala.gif" alt="Kanal A" /></a>&nbsp;&nbsp;&nbsp;
<a href="javascript:toggle_view('poptv');" title="POP TV"><img src="poptv.gif" alt="POP TV" /></a>&nbsp;&nbsp;&nbsp;
<br />
<?php
# functions
function compareTime($fTime, $sTime, $cTime)
{
   $ura1 = str_replace(":", "", $fTime);
   $ura2 = str_replace(":", "", $sTime);
   $cTime = str_replace(":", "", $cTime);
   $ura2 = ($ura2) ? $ura2 : $ura1+10;
   $ura1 = ($ura1 < 400) ? $ura1+2400 : $ura1;
   $ura2 = ($ura2 < 400) ? $ura2+2400 : $ura2;
   $cTime = ($cTime < 400) ? $cTime+2400 : $cTime;
   if($ura1 <= $cTime && $ura2 > $cTime)
      return true;
   else
      return false;
}
function DatWrite($file, $cont)
{
   $fp = fopen($file, "w+");
   fwrite($fp, $cont);
   fclose($fp);
}
function CheckFile($file, $url)
{
   $dir = "./cache/";
   $file = $dir.$file;
   if(!(file_exists($file) && (date("Ymd", filemtime($file)+(3600*24)) > date("Ymd", time()-400))))
      DatWrite($file, file_get_contents($url));
   return file_get_contents($file);
}
# functions
$time = date("H:i");
if (str_replace(":", "", $time) < 400)
{
   $min = 1;
   $date = date("Y-m-d", time()-3600*24);
}
else
   $date = date("Y-m-d");
$parDate = explode("-", $date);
$today = array();
// TVS 1 START
$cont = CheckFile('tvs1.dat', 'http://www.rtvslo.si/modload.php?&c_mod=rspored-v2&izbran_dan='.$date.'&izbran_program=1&s_content=xml');
$xml = simplexml_load_string($cont);
$pSeznam .= '<div id="tvs1" style="display: none;border: solid 1px #000000;">'."\n";
$k = 1;
$today[0][] = "TVS 1";
foreach($xml->spored AS $spored)
{
   $print = $spored->ura.' - '.$spored->naslov;
   if (compareTime($spored->ura, $xml->spored[$k]->ura, $time))
      $today[0][] = $print = '<b>'.str_replace("\r\n", "", $print).'</b>';
   $pSeznam .= '  <div style="width:100%;background-color:'.((($k-1)%2 == 0) ? '#9ccff0' : '#e5f5ff').';border: 0px;">'.$print."</div>\n";
   $k++;
}
$pSeznam .= '</div>'."\n";
// TVS 1 END

// TVS 2 START
$cont = CheckFile('tvs2.dat', 'http://www.rtvslo.si/modload.php?&c_mod=rspored-v2&izbran_dan='.$date.'&izbran_program=2&s_content=xml');
$xml = simplexml_load_string($cont);
$pSeznam .= '  <div id="tvs2" style="display: none;border: solid 1px #000000;">'."\n";
$k = 1;
$today[1][] = "TVS 2";
foreach($xml->spored AS $spored)
{
   $print = $spored->ura.' - '.$spored->naslov;
   if (compareTime($spored->ura, $xml->spored[$k]->ura, $time))
      $today[1][] = $print = '<b>'.str_replace("\n", "", $print).'</b>';
   $pSeznam .= '  <div style="width:100%;background-color:'.((($k-1)%2 == 0) ? '#9ccff0' : '#e5f5ff').';border: 0px;">'.$print."</div>\n";
   $k++;
}
$pSeznam .= '</div>'."\n";
// TVS 2 END

// Kanal A START
$src = CheckFile('kanala.dat', 'http://24ur.com/spored/kanala_'.mktime(0, 0, 0, date("m"), date("d")-$min, date("Y")).'.php');
$pSeznam .= '<div id="kanala" style="display: none;border: solid 1px #000000;">'."\n";
$today[2][] = "Kanal A";
if(eregi('<!-- TV Spored HEAD start -->(.*)<!--  zakljucek && links -->', $src, $temp))
{
   preg_match_all("/<span class=\"tv_clock\">(.+?)<\/span>/", $temp[1], $ura);
   preg_match_all("/tv__linkorange\">(.+?)<\/span>/", $temp[1], $spored);
   for($x=0;$x<count($ura[1]);$x++)
   {
      $print = $ura[1][$x]." - ".strip_tags(iconv('iso-8859-2', 'UTF-8', $spored[1][$x]));
      if (compareTime($ura[1][$x], $ura[1][$x+1], $time))
         $today[2][] = $print = '<b>'.$print.'</b>';
      $pSeznam .= '  <div style="width:100%;background-color:'.((($x)%2 == 0) ? '#9ccff0' : '#e5f5ff').';border: 0px;">'.$print."</div>\n";
   }
}
$pSeznam .= '</div>'."\n";
// Kanal A END

// POP TV START
$src = CheckFile('poptv.dat', 'http://24ur.com/spored/poptv_'.mktime(0, 0, 0, date("m"), date("d")-$min, date("Y")).'.php');
$pSeznam .= '<div id="poptv" style="display: none;border: solid 1px #000000;">'."\n";
$today[3][] = "POP TV";
if(eregi('<!-- TV Spored HEAD start -->(.*)<!--  zakljucek && links -->', $src, $temp))
{
   preg_match_all("/<span class=\"tv_clock\">(.+?)<\/span>/", $temp[1], $ura);
   preg_match_all("/tv__linkblue\">(.+?)<\/span>/", $temp[1], $spored);
   for($x=0;$x<count($ura[1]);$x++)
   {
      $print = $ura[1][$x]." - ".strip_tags(iconv('iso-8859-2', 'UTF-8', $spored[1][$x]));
      if (compareTime($ura[1][$x], $ura[1][$x+1], $time))
         $today[3][] = $print = '<b>'.$print.'</b>';
      $pSeznam .= '  <div style="width:100%;background-color:'.((($x)%2 == 0) ? '#9ccff0' : '#e5f5ff').';border: 0px;">'.$print."</div>\n";
   }
}
$pSeznam .= '</div>'."\n";
// POP TV END

echo 'Trenutno na TV: <br />'."\n";
foreach($today AS $a)
{
   if($a[1] == "")
      echo '<div style="border-bottom: solid 1px #000000;width: 600px;"><b>'.$a[0].':</b> &nbsp;&nbsp;Trenutno ni nic na sporedu :(</div>'."\n";
   else
      echo '<div style="border-bottom: solid 1px #000000;width: 600px;"><b>'.$a[0].':</b> &nbsp;&nbsp;'.strip_tags($a[1])."</div>\n";
}
echo "<br />\n".$pSeznam;
?>
</body>
</html>






red_mamba
član

št. sporočil: 248
datum: 06.04.2006 | čas: 07:11

Eh fantje, to je že vse narjeno: http://www.rtv.si







fREDi
član

št. sporočil: 960
datum: 06.04.2006 | čas: 08:40

to sm itak naredu enx k mi je blo dougcas, pa kot drugo je pa tko narjen da je men ql ;)



sebastijan
član

št. sporočil: 23
datum: 06.04.2006 | čas: 12:52

Se strinjam, da je narejeno. Kljub temu je zadeva uporabna za navidezno namizje Dashboard v obliki majhne datoteke imenovane widget (http://www.apple.com/downloads/dashboard/?r=dbw) in za prikaz v iCal (OS X).



Sebastijan Bauman
stran: [1]
stran je še vedno v izdelavi zato nekatere stvari manjkajo oz. niso dokončane
forum -
teme zadnjih 24h -
iskanje -
statistika -
pravila -
Kateri PHP framework uporabljate?

CakePHP
CodeIgniter
Drupal
Symfony
Yii
Zend Framework
Drugo

0.0852279663086
Število obiskov od 19.julija 2002: 1.872.911
php-si.com ne odgovarja za prispevke članov.
admin: lazo@php-si.com
Copyright © 2002 php-si.com. Vse pravice pridržane