Extraer las noticias de este sitio
http://www.notisistema.com/noticias/?x=0&y=0&s=ocotlan
Código PHP:
Ver original<script type="text/javascript" src="../dewplayer/swfobject.js"></script>
<?php
/**
* Clase para actuar como logger
*
* @author Christopher Valderrama
*/
class Logger {
private $handle;
public function __construct($logFile, $append = false)
{
$mode = ($append) ? 'a' : 'w';
$this->handle = fopen($logFile, $mode); }
public function log($info) {
$str = "[" . date("Y/m/d h:i:s", time()) . "] " . $info . "\r\n"; }
public function __destruct()
{
}
}
$log = new Logger('log.txt', true);
$doc = new DOMDocument();
$doc->loadHTMLFile('http://www.notisistema.com/noticias/?x=0&y=0&s=ocotlan');
$xpath = new DOMXPath($doc);
$peliculas = $xpath->query('//div[@class="post"]');
?>
<div style="width:1200px;">
<?php
for ($i = 0; $i < 6; $i++) {
$titulo = $peliculas->item($i)->getElementsByTagName('a')->item(0)->nodeValue;
$cuerpo = $peliculas->item($i)->getElementsByTagName('p')->item(1)->nodeValue;
$audio = $peliculas->item($i)->getElementsByTagName('audio')->item(0)->getAttribute('src');
echo "<div style='width:570px; margin:10px; height:340px; float:left; padding:5px; background:#cc092f; -webkit-border-radius: 8px; -moz-border-radius: 8px; border-radius: 8px;'>";
echo "<div style='font-size:22px;'>".utf8_decode($titulo)."</div>"; echo '<div id="dewplayer_content">
<object data="../dewplayer/dewplayer.swf" width="200" height="20" name="dewplayer" id="dewplayer" type="application/x-shockwave-flash">
<param name="movie" value="dewplayer.swf" />
<param name="flashvars" value="mp3='.$audio.'" />
<param name="wmode" value="transparent" />
</object>
</div>';
echo "<p><div style='width:565px; color:#23fbe4; font-size:18px;'>".utf8_decode($cuerpo)."</div></p>"; echo "<div class='clear'></div>";
echo "</div>";
}
?>
</div>
<div style="clear:both;"></div>