c93614 / rolling-curl

Automatically exported from code.google.com/p/rolling-curl
0 stars 0 forks source link

single_curl should remove the request from the queue #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If another request is added after executing a single request, it won't run 
as a single request since the first one still exists.

Sample Fix:
[code]
private function single_curl() {
    $ch = curl_init();
    $options = $this->get_options($this->requests[0]);
    curl_setopt_array($ch,$options);
    $output = curl_exec($ch);
    $info = curl_getinfo($ch);

    // Remove the request from the queue and reindex
    unset($this->requests[0]);
    $this->requests = array_values($this->requests);

    // it's not neccesary to set a callback for one-off requests
    if ($this->callback) {
        $callback = $this->callback;
        if (is_callable($this->callback)){
            call_user_func($callback, $output, $info);
        }
    } else {
        return $output;
    }
}
[/code]

Original issue reported on code.google.com by dianoga7 on 24 Feb 2010 at 5:22

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r16.

Original comment by alexander.makarow on 12 May 2010 at 10:11