private function returnApiData($xmlLocation)
{
$dataArray = array();
// Get the data
$httpCode = 206;
$page = 1;
while ($httpCode != 200) {
$ch = \curl_init();
\curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
\curl_setopt($ch, CURLOPT_URL, $xmlLocation);
\curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
\curl_setopt($ch, CURLOPT_HTTPHEADER, array("Page: {$page}", "Accept: application/xml", "Authorization: " . $this->_dev . ":" . $this->_api));
$dataArray[] = \curl_exec($ch);
$httpCode = \curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($httpCode != 200 && $httpCode != 206) {
throw new \Exception("Couldn't connect to the API");
}
\curl_close($ch);
$page++;
}
return $dataArray;
}