- <?php
- /*
- * Garfield comic by Jim Davis
- * RSS wrapper by fishy ( http://yhsif.com )
- * RSS wrapper source (what you are reading now) released under GPL v3
- */
- function shift_days($date, $days) {
- }
- function date2img($date) {
- }
- function date2url($date) {
- }
- function find_next_available_date($date, $cachedate) {
- $day = $date;
- $i = 0;
- while(1) {
- if($day <= $cachedate)
- break;
- $i++;
- if($i > 3) {
- $i--;
- break;
- }
- if($code == 200)
- break;
- $day = shift_days($day, -1);
- }
- print("<!-- fetched $i url(s) -->\n");
- return $day;
- }
- print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
- $cache_file = ".rss-cache";
- if($count == 0)
- $count = 10;
- $lastcheck = 0;
- $cacheday = 0;
- }
- $lastday = $cacheday;
- $lastday = find_next_available_date($lastday, $cacheday);
- } else
- print("<!-- cache hit -->\n");
- ?>
- <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
- <channel>
- <title>Garfield daily comic</title>
- <link>http://www.garfield.com/comics/comics_todays.html</link>
- <description>The daily comic of Garfield, from ucomics.com</description>
- <docs>http://blogs.law.harvard.edu/tech/rss</docs>
- <atom:link href="https://selif.yhsif.com/ga-rss.php" rel="self" type="application/rss+xml" />
- <?php
- for($i = 0; $i < $count; $i++) {
- $img = date2img($lastday);
- $url = date2url($lastday);
- $desc = "<![CDATA[<img src=\"$img\" />]]>";
- print <<<EOLAST
- <item>
- <title>$title</title>
- <link>$url</link>
- <guid>$url</guid>
- <pubDate>$date</pubDate>
- <description>$desc</description>
- </item>
- EOLAST;
- $lastday = shift_days($lastday, -1);
- }
- ?>
- </channel>
- </rss>
Raw Paste