Skip to content

Commit f2a4212

Browse files
committed
Modified call() to get HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT headers
1 parent 93ad301 commit f2a4212

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/RocketCode/Shopify/api.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,12 @@ public function call($userData = array(), $verifyData = TRUE)
274274

275275
curl_setopt_array($ch, $options);
276276

277-
$result = json_decode(curl_exec($ch), $request['RETURNARRAY']);
278-
$_INFO = curl_getinfo($ch);
279-
$_ERROR = array('NUMBER' => curl_errno($ch), 'MESSAGE' => curl_error($ch));
277+
$response = curl_exec($ch);
278+
$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
279+
280+
$result = json_decode(substr($response, $headerSize), $request['RETURNARRAY']);
281+
$_INFO = array_filter(array_map('trim', explode("\n", substr($response, 0, $headerSize))));
282+
$_ERROR = array('NUMBER' => curl_errno($ch), 'MESSAGE' => curl_error($ch));
280283

281284
curl_close($ch);
282285

0 commit comments

Comments
 (0)