-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathREADME
More file actions
61 lines (45 loc) · 1.92 KB
/
README
File metadata and controls
61 lines (45 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
README (MultiCurl class)
=========================================
NAME: MultiCurl class
VERSION: 1.07
AUTHOR: Vadym Timofeyev <tvad@mail333.com> http://weblancer.net/users/tvv/
DESCRIPTION:
MultiCurl class provides a convenient way to execute parallel HTTP(S)
requests via PHP MULTI CURL extension with additional restrictions.
For example: start 100 downloads with 2 parallel sessions, and get only
first 100 Kb per session.
Supported features:
- Set query for CURL multi sessions. The main idea you can use only
limited number of parallel requests. If you add next request and
the query is fully filled the script waits while one or some previous
CURL multi sessions will be completed.
- Set maximal size limit for downloaded content. Please note: it is
possible to download rather more bytes than the limit because download
operation uses internal buffer.
- Set common CURL options for all requests.
- Set separate CURL options for different requests if it is necessary.
SYNOPSIS:
<?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());
}
?>
COPYRIGHT:
Copyright (c) 2007 Vadym Timofeyev. All rights reserved.
This software is released under the GNU Lesser General Public License.
Please read the disclaimer at the top of the MultiCurl.class.php file.