public function execute() { $output = curl_exec($this->handler->ch); $isOutputRequired = isset($this->handler->outputFormatter); $error = curl_error($this->handler->ch); if ($error != '') { $this->errorResourceExecution($this->handler->resourceId, $error); } // storing some information about the execution into log $preparedExecutionInfo = NULL; ObjectHelper::copySelectedProperties( $preparedExecutionInfo, curl_getinfo($this->handler->ch), array( 'url', 'content_type', 'redirect_url', 'http_code', 'redirect_count', 'namelookup_time', 'connect_time', 'pretransfer_time', 'starttransfer_time', 'redirect_time', 'total_time', 'size_upload', 'upload_content_length', 'speed_upload', 'speed_download', 'download_content_length')); LogHelper::log_debug($preparedExecutionInfo); if ($isOutputRequired) { try { $output = $this->handler->outputFormatter->format($this->handler->resourceId, $output); } catch (Exception $e) { LogHelper::log_debug(new PreservedTextMessage($output)); throw $e; } } if ($preparedExecutionInfo->http_code != 200) { // only if formatting completed successfully we will reach this point $this->errorResourceExecution($this->handler->resourceId, $preparedExecutionInfo->http_code); } return $isOutputRequired ? $output : NULL; }