From dbb49c2d9160ef8c13670113bb34ce8452385a62 Mon Sep 17 00:00:00 2001 From: Horus Date: Sun, 17 Jan 2021 23:06:59 +0100 Subject: Initial commit. --- index.php | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 index.php (limited to 'index.php') diff --git a/index.php b/index.php new file mode 100644 index 0000000..f6f8872 --- /dev/null +++ b/index.php @@ -0,0 +1,83 @@ +link["href"]; + if ( $link != "" ) { + + $document = new Document($link, true); + $img = $document->find(".img-comic-container")[0]->find(".img-comic-link")[0]->find("img")[0]; + + $time = (string)$node->updated; + + $doc = new DOMDocument(); + $doc->loadHTML($img); + $xpath = new DOMXPath($doc); + $src = $xpath->evaluate("string(//img/@src)"); + $title = $xpath->evaluate("string(//img/@alt)"); + + $count++; + $return_values[$count]["title"] = $title; + $return_values[$count]["link"] = $src; + $return_values[$count]["time"] = $time; + $return_values[$count]["description"] = "".$title.""; + } + } + + return $return_values; +} + +function generate() { + $feed = new Feed(); + + $channel = new Channel(); + $channel + ->title("Dilbert") + ->description("Dilbert - with Pictures") + ->url( "https://feeds.iamfabulous.de/Dilbert.xml" ) + ->pubDate(strtotime(date("r", time()))) + ->lastBuildDate(strtotime(date("r", time()))) + ->ttl(5) + ->appendTo($feed); + + #->url("http://feeds.iamfabulous.de/".$name) + + + $r = get_dilbert_items(); + + foreach($r as $item) { + $item_out = new Item(); + + $item_out + ->title($item["title"]) + ->description($item["description"]) + ->url($item["link"]) + ->pubDate(strtotime(date($item["time"]))) + ->appendTo($channel); + } + + if ( ! file_exists( PUBLIC_DIR ) ) { + mkdir( PUBLIC_DIR ); + } + + file_put_contents(PUBLIC_DIR . '/Dilbert.xml', $feed ); +} + +generate(); -- cgit v1.2.3