Login   Register  
PHP Classes

File: sample1.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Tomasz Malewski  >  adv_wdt  >  sample1.php  >  Download  
File: sample1.php
Role: Example script
Content type: text/plain
Description: Sample 1
Class: adv_wdt
Track changes of pages in a MySQL database
Author: By
Last change: Accessible for everbody
Date: 3 years ago
Size: 1,113 bytes


Class file image Download

include 'adv_wdt.php';
$wdt = new adv_wdt;
$url "http://google.com/";        // set desired URL to tracking

// print_R ( $wdt-> curl ($url));        // just return page content 
// echo "<li> Page length is:".$wdt->curl[length]." , and MD5 checksum: ".$wdt->curl[checksum]."<br>";

$wdt->sql_connect ('localhost','username','password','dbname','adv_wdt');         // connect to temporary SQL table, need create first one
// $wdt -> sql_conect ('host','username','password','database','table');     

$wdt->sql_delURL($url);    // delete URL from table if any
$wdt->sql_addURL($url);    // add URL to our table
echo "<li> $url is added,  current length is ".$wdt->curl[length]."<br>";

if (
$wdt->sql_diffURL($url) == true ) {        // check if webpage has changed since last add URL, only active records are checking !
echo "<li> $url has changed new length is ".$wdt->curl[length]."<br>";
// $wdt->sql_deactivateURL($url);    // instead of delete you can only deactivate URL
    // $wdt->sql_activateURL($url);        // active URL previously deactivated
$wdt->sql_delURL($url);    // delete URL from table 
}    // diffURL