diff --git a/lemonde.php b/lemonde.php index 53bbdf4..fcbb75f 100644 --- a/lemonde.php +++ b/lemonde.php @@ -2,20 +2,27 @@
extracted url from curl command:' . $url . '
'; + } + $epub = new TPEpubCreator(); $epub->temp_folder = 'temp/'; $epub->epub_file = $_POST['epub']; $epub->title = $_POST['title']; - + if ($_POST['cover']) { $coverurl = $_POST['cover']; @@ -23,7 +30,7 @@ file_put_contents('temp/cover.jpg', $coverdata); $epub->AddImage( 'temp/cover.jpg', 'image/jpeg', true ); } - + // cache json in case url expires $tempjsonpath = 'temp/' . hash('md5', $url) . '.json'; $json = ''; @@ -40,7 +47,7 @@ $publication = json_decode($json); $content = array_filter($publication->Content, function($item) { return $item->Category == 'Le Monde'; }); usort($content, function ($a, $b) { return $a->PageNumber - $b->PageNumber; }); - + foreach ($content as $article) { $articlebody = array_filter($article->ContentItem, function($item) { return $item->ContentType == 'text/xml'; })[0]; @@ -57,19 +64,19 @@ // echo($articlebody->HtmlText); } } - + if ( ! $epub->error ) { $epub->CreateEPUB(); - + if ( ! $epub->error ) { echo 'Success: Download your book here.'; } - + } else { echo $epub->error; } } - + ?> + + \ No newline at end of file