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 Vadym Timofeyev  >  MultiCurl  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example
Class: MultiCurl
Retrieve multiple pages simultaneously
Author: By
Last change: Version 1.07
Date: 4 years ago
Size: 574 bytes
 

Contents

Class file image Download
<?php
include_once '../MultiCurl.class.php';

class 
MyMultiCurl extends MultiCurl {
    protected function 
onLoad($url$content$info) {
        print 
"[$url$content ";
        
print_r($info);
    }
}

try {
    
$mc = new MyMultiCurl();
    
$mc->setMaxSessions(2); // limit 2 parallel sessions (by default 10)
    
$mc->setMaxSize(10240); // limit 10 Kb per session (by default 10 Mb)
    
$mc->addUrl('http://google.com');
    
$mc->addUrl('http://yahoo.com');
    
$mc->addUrl('http://altavista.com');
    
$mc->wait();
} catch (
Exception $e) {
    die(
$e->getMessage());
}