big update's coming
[mdref/mdref-http] / http / Client / notify.md
1 # http\Client http\Client::notify([http\Client\Request $request = NULL[, object $progress = NULL]])
2
3 Implements SplSubject. Notify attached observers about progress with $request.
4
5 ## Params:
6
7 * Optional http\Client\Request $request = NULL
8 The request to notify about.
9 * Optional object $progress = NULL
10 stdClass instance holding progress information.
11
12 ## Returns:
13
14 * http\Client, self.
15
16 ## Throws:
17
18 * http\Exception\InvalidArgumentException
19 * http\Exception\UnexpectedValueException
20
21 ## Example:
22
23 <?php
24 class Observer implements SplObserver {
25 function update(SplSubject $client, http\Client\Request $request = NULL, $progress = NULL) {
26 printf("%s %d%%\n", $progress->info,
27 $progress->dltotal ? ($progress->dlnow*100/$progress->dltotal) : 0);
28 }
29 }
30
31 $client = new http\Client;
32
33 $client->attach(new Observer);
34 $client->enqueue(new http\Client\Request("GET", "https://php.net/images/logos/php-logo.eps"));
35 $client->send();
36 ?>
37
38 May yield:
39
40 start 0%
41 setup 0%
42 setup 0%
43 setup 0%
44 setup 0%
45 setup 0%
46 resolve 0%
47 connect 0%
48 connected 0%
49 connected 0%
50 connected 0%
51 ssl negotiation 0%
52 ssl negotiation 0%
53 ssl negotiation 0%
54 ssl negotiation 0%
55 ssl negotiation 0%
56 ssl negotiation 0%
57 ssl negotiation 0%
58 ssl negotiation 0%
59 ssl negotiation 0%
60 ssl negotiation 0%
61 ssl negotiation 0%
62 ssl negotiation 0%
63 ssl negotiation 0%
64 ssl negotiation 0%
65 ssl negotiation 0%
66 ssl negotiation 0%
67 ssl negotiation 0%
68 ssl negotiation 0%
69 blacklist check 0%
70 receive 10%
71 receive 20%
72 receive 30%
73 receive 40%
74 receive 50%
75 receive 60%
76 receive 70%
77 receive 80%
78 receive 90%
79 receive 100%
80 receive 100%
81 not disconnected 100%
82 finished 100%