PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Moritz HeidkampPreview the content newsletter M   iviDownloader   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Explains basic functionality
Class: iviDownloader
Retrieving files linked of a page given its URL
Author: By
Last change: fixed variable name
Date: 19 years ago
Size: 1,289 bytes


Class file image Download

 * Explaining basic functionality of the iviDownloader class
 * @author Moritz Heidkamp
 * @version $Id 1.0$
 * @copyright 2003


// Initialize iviDownloader
$downloader =& new iviDownloader();

// Get *.mpg, *.jpg and *.jpeg links from all URLs given in $_GET['url'] seperated by commas (,)
// The second argument declares that previous results may be deleted (clear result list)
// See iviDownloader.class.php for detailed information
$downloader->get(explode(',', $_GET['url']), true, 'mpg|jpe?g');

// Simply output results
foreach($downloader->files as $url => $files)
'<h1>Files from ' . $url . '</h1>');
    foreach (
$files as $file) {
'<a href="' . $file . '">' . $file . '</a><br /><br />');

// Download and save all result files to DOCUMENT_ROOT.
// Each URL will get its own directory starting from 00001 ascending.
// The second argument declares that the downloaded files will be renamed to numeric filenames with an ascending number.
// The third argument declares that the file "info.txt" should be written.
// See iviDownloader.class.php for detailed information

//$downloader->save($_SERVER['DOCUMENT_ROOT'], true, true);