Skip to content

Commit c69a372

Browse files
author
John Hutcheson
committed
Adding HEADERS option and updating README
1 parent 197d66c commit c69a372

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,15 @@ const DEBUGGER_LOG_FILE = 'path/to/some/file.php';
225225

226226
By default this option is on.
227227

228+
### Request Headers
229+
To include the returned headers in the output from this library set:
230+
231+
```php
232+
const HEADERS = true;
233+
```
234+
235+
By default this option is set to false.
236+
228237

229238
\*\*Please watch for updates, and feel free to Fork or Pull Request. Check out the Wiki for a little more info on contributing.
230239

src/mailchimpRoot.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Mailchimp
99
const DEBUGGER = false;
1010
const DEBUGGER_LOG_FILE = null;
1111
const VERIFY_SSL = true;
12-
12+
const HEADERS = false;
1313

1414
// Request components
1515
public $auth;
@@ -160,6 +160,7 @@ public function curlGet($url)
160160
$ch = curl_init($url);
161161
curl_setopt($ch, CURLOPT_HTTPHEADER, $this->auth);
162162
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
163+
curl_setopt($ch, CURLOPT_HEADER, self::HEADERS);
163164
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, self::VERIFY_SSL);
164165
$this->response = curl_exec($ch);
165166
$this->http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
@@ -176,6 +177,7 @@ public function curlPost($url, $payload)
176177
curl_setopt($ch, CURLOPT_HTTPHEADER, $this->auth);
177178
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
178179
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, self::VERIFY_SSL);
180+
curl_setopt($ch, CURLOPT_HEADER, self::HEADERS);
179181
curl_setopt($ch, CURLOPT_POST, true);
180182
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
181183
$this->response = curl_exec($ch);
@@ -193,6 +195,7 @@ public function curlPatch($url, $payload)
193195
curl_setopt($ch, CURLOPT_HTTPHEADER, $this->auth);
194196
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
195197
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, self::VERIFY_SSL);
198+
curl_setopt($ch, CURLOPT_HEADER, self::HEADERS);
196199
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PATCH");
197200
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
198201
$this->response = curl_exec($ch);
@@ -210,6 +213,7 @@ public function curlDelete($url)
210213
curl_setopt($ch, CURLOPT_HTTPHEADER, $this->auth);
211214
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
212215
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, self::VERIFY_SSL);
216+
curl_setopt($ch, CURLOPT_HEADER, self::HEADERS);
213217
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
214218
$this->response = curl_exec($ch);
215219
$this->http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
@@ -226,6 +230,7 @@ public function curlPut($url, $payload)
226230
curl_setopt($ch, CURLOPT_HTTPHEADER, $this->auth);
227231
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
228232
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, self::VERIFY_SSL);
233+
curl_setopt($ch, CURLOPT_HEADER, self::HEADERS);
229234
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
230235
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
231236
$this->response = curl_exec($ch);

0 commit comments

Comments
 (0)