Skip to content
This repository has been archived by the owner on May 11, 2018. It is now read-only.

Commit

Permalink
Merge pull request #40 from robinwo/master
Browse files Browse the repository at this point in the history
Added option to enable sending cookies via config
  • Loading branch information
chriskacerguis committed Jul 17, 2014
2 parents 296de79 + 649c992 commit ec698f2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions libraries/Rest.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ public function initialize($config)
$this->rest_server .= '/';
}

isset($config['send_cookies']) && $this->send_cookies = $config['send_cookies'];

isset($config['api_name']) && $this->api_name = $config['api_name'];
isset($config['api_key']) && $this->api_key = $config['api_key'];

Expand Down Expand Up @@ -260,6 +262,14 @@ protected function _call($method, $uri, $params = array(), $format = NULL)
$this->_ci->curl->http_header($this->api_name, $this->api_key);
}

// Send cookies with curl
if ($this->send_cookies != '')
{

$this->_ci->curl->set_cookies( $_COOKIE );

}

// Set the Content-Type (contributed by https://github.com/eriklharper)
$this->http_header('Content-type', $this->mime_type);

Expand Down

0 comments on commit ec698f2

Please sign in to comment.