$d = date("d", $this->t); $dir = "tapas/{$y}/{$m}/{$d}"; if (!file_exists($dir)) { mkdir($dir, 0777, true); } foreach ($diarios as $diario => $url) { echo "{$diario}... "; $ext = endsWith($url, 'pdf') ? 'pdf' : 'jpg'; @($f = fopen($url, 'r')); if ($f) { file_put_contents("{$dir}/{$diario}.{$ext}", $f); } echo "done<br>"; } } function download() { $this->download_diarios($this->ejes()); $diarios = array(); $news = array('Ambito' => 'ARG_DAF', 'BuenosAiresHerald' => 'ARG_BAH', 'LaNacion' => 'ARG_LN', 'Clarin' => 'ARG_CLA'); foreach ($news as $diario => $tapa) { $diarios[$diario] = $this->newseum($tapa); } $this->download_diarios($diarios); } } $tapas = new tapas(); if (isset($_GET['d'])) { $tapas->days_before($_GET['d']); } $tapas->download();
return '<img src="' . $img . '" style="width:100%;"><br>'; } } } function py_cva() { $ret = ''; $ret .= '<img src="' . 'http://py.cvamedios.com/images/uh.jpg' . '" style="width:100%;"><br>'; $ret .= '<img src="' . 'http://py.cvamedios.com/images/abc.jpg' . '" style="width:100%;"><br>'; $ret .= '<img src="' . 'http://py.cvamedios.com/images/5dias.jpg' . '" style="width:100%;"><br>'; $ret .= '<img src="' . 'http://py.cvamedios.com/images/lnpy.jpg' . '" style="width:100%;"><br>'; return $ret; } function show() { $tapas = array($this->ejes_(), $this->newseum('PAR_UH'), $this->py_5dias(), $this->py_lanacion(), $this->py_cva(), $this->newseum('WSJ'), $this->newseum('DC_WP'), $this->kiosko('uk/ft_uk'), $this->newseum('NY_NYT')); foreach ($tapas as $tapa) { echo $tapa . "\n"; } } } $tapas = new tapas(); if (isset($_GET['d'])) { $tapas->days_before($_GET['d']); } $tapas->show(); ?> </body> </html>