function getPlans($nombre_fichero) { include 'content.php'; $gestor = fopen($nombre_fichero, "r"); $contenido = fread($gestor, filesize($nombre_fichero)); fclose($gestor); $array_version = json_decode($contenido, true); $max = 6; echo "Planes a Mostrar:"; for ($i = 1; $i < $max; $i++) { $plan = "plan" . $i; $url = $array_version[0][$plan]; $data = getOne($url); $cabecera = HEAD(); $pie = FOOT(); $contenido = explode("|", $data); if (file_exists($plan . ".html")) { unlink($plan . ".html"); } $fp = fopen($plan . ".html", "a+"); fwrite($fp, $cabecera); fwrite($fp, $contenido[1]); fwrite($fp, "\n</div></div\n"); fwrite($fp, $pie); fclose($fp); if ($i == 1) { $acumulador = uneJson($i, $contenido[0]); //echo $acumulador; traeImg($contenido[0]); } else { $acumulador = uneJson($i, $contenido[0], $acumulador); } echo "<br><a href='" . $plan . ".html'>" . $url . "</a>"; } if (file_exists("planes.json")) { unlink("planes.json"); } $fp = fopen("planes.json", "a+"); fwrite($fp, $acumulador); fclose($fp); echo "<br><a href='planes.json'>json</a><br>Sistema Activo."; }
#!/usr/bin/env php <?php error_reporting(E_ALL); require_once '../KvzHTML.php'; // These are the default options, so might // as well have initialized KvzHTML with an // empty first argument $H = new KvzHTML(array('xhtml' => true, 'track_toc' => false, 'link_toc' => true, 'indentation' => 4, 'newlines' => true, 'echo' => false, 'buffer' => false, 'xml' => false, 'tidy' => false)); $tags = "html,head,title,body,h1,p,h2,table,th,tr,td"; foreach (explode(',', $tags) as $tag) { $TAG = strtoupper($tag); $evalMe = "function {$TAG}(\$a) { global \$H; return \$H->{$tag}(\$a); };"; eval($evalMe); } $output = HTML(HEAD(TITLE('My page')) . BODY(H1('Important website', array('bye' => 'ciao')) . P('Welcome to our website.') . H2('Users') . P('Here\'s a list of current users:') . TABLE(TR(TH('id') . TH('name') . TH('age')) . TR(TD('#1') . TD('Kevin van Zonneveld') . TD('26')) . TR(TD('#2') . TD('Foo Bar') . TD('28'))))); echo $output;