Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  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: 2003-08-17 12:31
Size: 1,289 bytes
 

Contents

Class file image Download
<?php

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

require_once('iviDownloader.class.php');

// 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)
{
    print(
'<h1>Files from ' $url '</h1>');
    
    foreach (
$files as $file) {
        print(
'<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);

?>