68 'Request has already been sent cannot '.__METHOD__
73 'As a CAS_Request_CurlMultiRequest, I can only work with CAS_Request_CurlRequest objects.' 77 $this->_requests[] = $request;
89 'Request has already been sent cannot '.__METHOD__
92 return count($this->_requests);
110 'Request has already been sent cannot send again.' 113 if (!count($this->_requests)) {
115 'At least one request must be added via addRequest() before the multi-request can be sent.' 123 $multiHandle = curl_multi_init();
124 foreach ($this->_requests as $i => $request) {
125 $handle = $request->initAndConfigure();
126 curl_setopt($handle, CURLOPT_RETURNTRANSFER,
true);
127 $handles[$i] = $handle;
128 curl_multi_add_handle($multiHandle, $handle);
133 curl_multi_exec($multiHandle, $running);
134 }
while ($running > 0);
137 foreach ($this->_requests as $i => $request) {
138 $buf = curl_multi_getcontent($handles[$i]);
139 $request->_storeResponseBody($buf);
140 curl_multi_remove_handle($multiHandle, $handles[$i]);
141 curl_close($handles[$i]);
144 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.
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.
Create styles array
The data for the language used.
send()
Perform the request.
This interface defines a class library for performing multiple web requests in batches.