File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -84,3 +84,33 @@ $curl->close();
84
84
curl_set_opt($curl->curl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1');
85
85
curl_close($curl->curl);
86
86
```
87
+
88
+ ``` php
89
+ // Requests in parallel with callback functions.
90
+ $curl = new Curl();
91
+ $curl->setOpt(CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1');
92
+
93
+ $curl->success(function($instance) {
94
+ echo 'call was successful. response was' . "\n";
95
+ echo $instance->response . "\n";
96
+ });
97
+ $curl->error(function($instance) {
98
+ echo 'call was unsuccessful.' . "\n";
99
+ echo 'error code:' . $instance->error_code . "\n";
100
+ echo 'error message:' . $instance->error_message . "\n";
101
+ });
102
+ $curl->complete(function($instance) {
103
+ echo 'call completed' . "\n";
104
+ });
105
+
106
+ $curl->get(array(
107
+ 'https://duckduckgo.com/',
108
+ 'https://search.yahoo.com/search',
109
+ 'http://www.bing.com/search',
110
+ 'http://www.dogpile.com/search/web',
111
+ 'https://www.google.com/search',
112
+ 'https://www.wolframalpha.com/input/',
113
+ ), array(
114
+ 'q' => 'hello world',
115
+ ));
116
+ ```
You can’t perform that action at this time.
0 commit comments