private function download_json($json, $id) { header('Content-Description: File Transfer'); header('Content-Type: application/json'); header('Content-Disposition: attachment; filename="article-' . absint($id) . '.json"'); echo $json; die; }