diff --git a/src/InstagramBasicDisplay.php b/src/InstagramBasicDisplay.php index dbd83ec..02e1680 100644 --- a/src/InstagramBasicDisplay.php +++ b/src/InstagramBasicDisplay.php @@ -294,13 +294,14 @@ protected function _makeCall($function, $params = null, $method = 'GET') curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HEADER, true); - $jsonData = curl_exec($ch); + $response = curl_exec($ch); - if (!$jsonData) { + if (!$response) { throw new InstagramBasicDisplayException('Error: _makeCall() - cURL error: ' . curl_error($ch), curl_errno($ch)); } - list($headerContent, $jsonData) = explode("\r\n\r\n", $jsonData, 2); + $responseParts = explode("\r\n\r\n", $response); + $jsonData = $responseParts[array_key_last($responseParts)]; curl_close($ch);