Skip to content

Instantly share code, notes, and snippets.

@Stasonix
Created June 30, 2012 11:38
Show Gist options
  • Save Stasonix/3023488 to your computer and use it in GitHub Desktop.
Save Stasonix/3023488 to your computer and use it in GitHub Desktop.
simple parse
<?php
$html = file_get_contents($page);
preg_match_all("/(<h3>(\d+:\d+)<\/h3>).+?(<h5>(.*?)<\/h5>)/is",$html,$matches);
echo "<h2 align='center'>LIVE</h2>";
echo "<br /><hr>";
// var_dump($matches[0]);
$tv = array();
for ($i = 0 ; $i<count($matches[2]) ; $i++) {
$tv[$matches[2][$i]] = $matches[3][$i];
}
echo "<pre>";
// var_dump($tv);
$live = array();
foreach ($tv as $time => $prog) {
if (preg_match("/icoLive.png/",$prog)) {
if (!preg_match("/news|жара|люблю/i",$prog)) {
$live[$time] = trim(strip_tags($prog));
}
}
}
var_dump($live);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment