67 'Request has already been sent cannot ' . __METHOD__
72 'As a CAS_Request_CurlMultiRequest, I can only work with CAS_Request_CurlRequest objects.' 88 'Request has already been sent cannot ' . __METHOD__
91 return count($this->_requests);
109 'Request has already been sent cannot send again.' 112 if (!count($this->_requests)) {
114 'At least one request must be added via addRequest() before the multi-request can be sent.' 122 $multiHandle = curl_multi_init();
123 foreach ($this->_requests as
$i =>
$request) {
124 $handle =
$request->initAndConfigure();
125 curl_setopt($handle, CURLOPT_RETURNTRANSFER,
true);
126 $handles[
$i] = $handle;
127 curl_multi_add_handle($multiHandle, $handle);
132 curl_multi_exec($multiHandle, $running);
133 }
while ($running > 0);
136 foreach ($this->_requests as
$i =>
$request) {
137 $buf = curl_multi_getcontent($handles[
$i]);
139 curl_multi_remove_handle($multiHandle, $handles[$i]);
140 curl_close($handles[$i]);
143 curl_multi_close($multiHandle);
addRequest(CAS_Request_RequestInterface $request)
Add a new Request to this batch.
getNumRequests()
Retrieve the number of requests added to this batch.
This interface defines a class library for performing multiple web requests in batches.
foreach($paths as $path) $request
This interface defines a class library for performing web requests.
Provides support for performing web-requests via curl.
This class defines Exceptions that should be thrown when the sequence of operations is invalid...
Exception that denotes invalid arguments were passed.
send()
Perform the request.
This interface defines a class library for performing multiple web requests in batches.