PHP Classes

File: daily_update.php

Recommend this page to a friend!
  Classes of Olaf Lederer   Import templates   daily_update.php   Download  
File: daily_update.php
Role: Example script
Content type: text/plain
Description: An example to updat (daily) the database with data
Class: Import templates
Import data about TemplateMonster.com templates
Author: By
Last change:
Date: 19 years ago
Size: 973 bytes
 

Contents

Class file image Download
<?php
set_time_limit
(240);
require(
$_SERVER['DOCUMENT_ROOT']."/classes/import_templates/import_templates.php");

function
microtime_float() {
   list(
$usec, $sec) = explode(" ", microtime());
   return ((float)
$usec + (float)$sec);
}
$time_start = microtime_float();
$body = "You updated the template shop...\r\n\r\n";

$daily_import = new Import_templates;
$body .= $daily_import->daily_update();

$time_end = microtime_float();
$time = $time_end - $time_start;

$body .= "The script's execution time was ".number_format($time, 4, ".", "")." seconds...";
$body .= "\n\r\n\rCheck here: http://".$_SERVER['HTTP_HOST'];

$header = "From: \"yoursite.com\" <templates@yoursite.com>\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: text/plain; charset=\"utf-8\"\r\n";
$header .= "Content-Transfer-Encoding: 7bit\r\n";
$subject = "Template import from ".date("d-m-Y");
mail("your@mail.com", $subject, $body, $header);
exit;
?>