Skip to content

Commit

Permalink
Merge pull request #23 from spinen/master
Browse files Browse the repository at this point in the history
Allow for an option that does not start with CURLOPT such as CURLINFO_HEADER_OUT
  • Loading branch information
Phil Sturgeon committed Oct 1, 2013
2 parents a61bb18 + decdea6 commit db94c52
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions libraries/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,11 @@ public function options($options = array())
return $this;
}

public function option($code, $value)
public function option($code, $value, $prefix = 'opt')
{
if (is_string($code) && !is_numeric($code))
{
$code = constant('CURLOPT_' . strtoupper($code));
$code = constant('CURL' . strtoupper($prefix) . '_' . strtoupper($code));
}

$this->options[$code] = $value;
Expand Down Expand Up @@ -302,19 +302,19 @@ public function execute()
// Execute the request & and hide all output
$this->response = curl_exec($this->session);
$this->info = curl_getinfo($this->session);

// Request failed
if ($this->response === FALSE)
{
$errno = curl_errno($this->session);
$error = curl_error($this->session);

curl_close($this->session);
$this->set_defaults();

$this->error_code = $errno;
$this->error_string = $error;

return FALSE;
}

Expand Down

0 comments on commit db94c52

Please sign in to comment.