Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion lib/ConsumerStrategies/CurlConsumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ class ConsumerStrategies_CurlConsumer extends ConsumerStrategies_AbstractConsume
*/
protected $_fork = null;

/**
* @var string|null additional verification for endpoint /import
*/
protected $_api_key;


/**
* Creates a new CurlConsumer and assigns properties from the $options array
Expand All @@ -49,6 +54,7 @@ function __construct($options) {
$this->_timeout = array_key_exists('timeout', $options) ? $options['timeout'] : 1;
$this->_protocol = array_key_exists('use_ssl', $options) && $options['use_ssl'] == true ? "https" : "http";
$this->_fork = array_key_exists('fork', $options) ? ($options['fork'] == true) : false;
$this->_api_key = array_key_exists('api_key', $options) ? $options['api_key'] : null;

// ensure the environment is workable for the given settings
if ($this->_fork == true) {
Expand Down Expand Up @@ -100,6 +106,10 @@ protected function _execute($url, $data) {
$this->_log("Making blocking cURL call to $url");
}

if(!is_null($this->_api_key)){
$data .= '&api_key='.$this->_api_key;
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
Expand Down Expand Up @@ -144,4 +154,4 @@ protected function _execute_forked($url, $data) {

return $return_var == 0;
}
}
}