<?php

include ('json.php');
$json = new Services_JSON();

// Probando aver que onda
// codeado por artux - www.artux.com.ar

// Configurando
$cache_time 60 60// Definiendo el tiempo de cacheo
$cache_file "./json.html"// definiendo el nombre y ubicacion del archivo a cachear

// Leyendo el ultimo post de anieto2k.com desde el feed json.

    
if (file_exists($cache_file) && (time() - $cache_time filemtime($cache_file))) {
        include_once(
$cache_file);
        echo 
"<!-- Cached: " date("Y-m-d H:i:s"filemtime($cache_file)) . " -->\n";
    }
    else {
        
$site file_get_contents('http://www.anieto2k.com/wp-json.php');
    
        
$value $json->decode($site);
    
        
$data get_object_vars($value);
        
        
$show get_object_vars($data['entries']['0']);
        
        
$titulo $show['title'];
        
$link $show['id'];
        
$contenido $show['content'];
        
        
$content '<html xmlns="http://www.w3.org/1999/xhtml">'."\n";
        
$content .= "<head>\n";
        
$content .= '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'."\n";
        
$content .= "<title>leyendo el ultimo post de anieto2k.com - by www.artux.com.ar</title>\n";
        
$content .= "</head>\n";
        
$content .= "<body>\n";
        
$content .= "<div id='json'>\n";
        
$content .= "<h1>leyendo el Ășltimo post de anieto2k.com desde el feed JSON</h1>\n";
        
$content .= "<p><b>url</b>: http://www.anieto2k.com/wp-json.php</p>";
        
$content .= "<h2><a href='" $link "'>" $titulo "</a></h2>\n";
        
$content .= $contenido;
        
$content .= "</div>";
        
$content .= "<!-- la prueba de fuego -->\n";
        
$content .= "<!-- www.artux.com.ar -->\n";
        
$content .= "</body>\n";
        
$content .= "</html>\n";
        
        
$fp fopen($cache_file"w");
        
fwrite($fp$content);
        
fclose($fp);
        
        echo 
$content;
    }

?>