open('feeds.epub', ZipArchive::CREATE);
// Create the required directory structure
$epub->addEmptyDir('META-INF');
$epub->addEmptyDir('OEBPS');
// Create the container.xml file
$containerXml = '
'; $contentHtml .= htmlspecialchars($output, ENT_QUOTES, 'UTF-8'); $contentHtml .= ''; $epub->addFromString('OEBPS/content.html', $contentHtml); // Close the EPUB file $epub->close(); // Download the EPUB file header('Content-Type: application/epub+zip'); header('Content-Disposition: attachment; filename="' . $filename . '"'); header('Content-Length: ' . filesize('feeds.epub')); readfile('feeds.epub'); exit; ?>