open('feeds.epub', ZipArchive::CREATE); // Create the required directory structure $epub->addEmptyDir('META-INF'); $epub->addEmptyDir('OEBPS'); // Create the container.xml file $containerXml = ' '; $epub->addFromString('META-INF/container.xml', $containerXml); // Create the content.opf file $contentOpf = ' '.$filename.' Author Name urn:uuid:12345678-1234-1234-1234-123456789012 en '; $epub->addFromString('OEBPS/content.opf', $contentOpf); // Create the toc.ncx file $tocNcx = ' Planet Mozilla RSS Feeds '; $epub->addFromString('OEBPS/toc.ncx', $tocNcx); // Create the content.html file $contentHtml = ' RSS Feeds Book
';

$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; ?>