Skip to content

Conversation

@griffy
Copy link
Contributor

@griffy griffy commented Aug 3, 2015

This was done mainly to allow for an Httpful\Request to be used with curl_multi_exec like so:

$mh = curl_multi_init();
$requests = array(...);
foreach ($requests as $index => $request) {
    curl_multi_add_handle($mh, $request->_ch);
}

do {
    $status = curl_multi_exec($mh, $running);
} while ($status === CURLM_CALL_MULTI_PERFORM || $running);

$responses = array();
foreach ($requests as $index => $request) {
    $responses[$index] = $request->buildResponse(curl_multi_getcontent($request->_ch));
    curl_multi_remove_handle($mh, $request->_ch);
    curl_close($request->_ch);
}

Not sure if true curl_multi_exec support is desired or within the scope of Httpful, so this is a quick workaround for now.

nategood pushed a commit that referenced this pull request Oct 26, 2015
Move Response building logic into separate function
@nategood nategood merged commit ae8a698 into nategood:master Oct 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants