Exemplo n.º 1
0
 /**
  * Perform request and populate data from response
  *
  * @throws ChurnBeeException
  */
 public function flush()
 {
     if ($this->cbconf->isAsync() == false) {
         foreach ($this->queue as $k => $r) {
             $r['url'] = $this->appendTo($r['url'], "accessToken", $this->cbconf->getAccessToken());
             $curl = new CurlUtil($r['method'], $r['url']);
             $curl->setTimeOut($this->cbconf->getCurlTimeout());
             $curl->send();
             $this->splitHeaderAndResponse($k, $curl->getResult());
             $this->sentHeaders[$k] = $curl->getSentHeaders();
             $this->statusCode[$k] = $curl->getStatusCode();
             $this->addError($k, $curl->getError());
         }
         $this->handleErrors();
         $this->debug();
         $this->clearQueue();
     } else {
         foreach ($this->queue as $k => $r) {
             $r['url'] = $this->appendTo($r['url'], "accessToken", $this->cbconf->getAccessToken());
             $this->flushAsync($k, $r['method'], $r['url']);
         }
     }
 }