private function parseJsonResponse($response, $code, $headers) { $location = null; $r = json_decode($response, true); if ($this->method == "LIST") { $this->response["meta"] = $r["meta"]; $this->response["resources"] = $r["objects"]; $this->response["error"] = null; $this->response["code"] = $code; } else { if ($this->method == "DELETE") { $this->response["code"] = $code; } else { $headers = explode("\n", $headers); foreach ($headers as $header) { if (stripos($header, 'Location:') !== false) { $cad = explode("Location:", $header); $this->response["location"] = trim($cad[1]); $location = $this->response["location"]; break; } } $this->response["code"] = $code; $this->response["resource"] = $r["resource"]; $this->response["error"] = null; $this->response["object"] = $r; maybe_save($this->response, BigML::getStorage(), $code, $location); } } }