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

Commit ec698f2

Browse files
Merge pull request #40 from robinwo/master
Added option to enable sending cookies via config
2 parents 296de79 + 649c992 commit ec698f2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

libraries/Rest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ public function initialize($config)
9292
$this->rest_server .= '/';
9393
}
9494

95+
isset($config['send_cookies']) && $this->send_cookies = $config['send_cookies'];
96+
9597
isset($config['api_name']) && $this->api_name = $config['api_name'];
9698
isset($config['api_key']) && $this->api_key = $config['api_key'];
9799

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

265+
// Send cookies with curl
266+
if ($this->send_cookies != '')
267+
{
268+
269+
$this->_ci->curl->set_cookies( $_COOKIE );
270+
271+
}
272+
263273
// Set the Content-Type (contributed by https://github.com/eriklharper)
264274
$this->http_header('Content-type', $this->mime_type);
265275

0 commit comments

Comments
 (0)