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

Added option to enable sending cookies via config #40

Merged
merged 1 commit into from
Jul 17, 2014
Merged
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
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