<?php
/************************************************************************/
/* */
/* User Friendly Comic Block */
/* ========================= */
/* */
/* Copyright (c) 2002 by Chris Karakas <chris@karakas-online.de> */
/* http://www.karakas-online.de */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/* */
/* This PHP block will display the daily comic from the */
/* well-known User Friendly site (www.userfriendly.org). */
/* It reads the page http://www.userfriendly.org/static/ line by line, */
/* searches for the pattern */
/* */
/* whatever<IMG ALT="Latest Strip"whateverSRC="imagefile">whatever, */
/* */
/* extracts the location of the image file (imagefile) from it */
/* and displays it. */
/* */
/* Please mail me if this should not work some day. In the meantime, */
/* enjoy! */
/* */
/* Chris */
/* */
/************************************************************************/
$ufurl = "http://www.userfriendly.org/static/"; $content = "<i>ufurl:</i> $ufurl<br>";
$imagefile = "";
if (!($textfile = fopen( "$ufurl", "r"))) {
$content .= "$ufurl<br> could not be opened<br>";
die();
}
while (!feof($textfile)) {
$line = fgets($textfile, 1500);
if (eregi( ".*<IMG ALT="Latest Strip".*SRC="(.*)">.*", $line, $out)) {
$imagefile = $out[1];
break;
}
}
fclose($textfile);
$content = "<p align=center>"; $content .= "<A HREF="http://www.userfriendly.org" target="_blank"><IMG SRC="$imagefile" alt="User Friendly by Illiad"></A>";
$content .= "<p>"; $content .= "See the <a href="http://www.karakas-online.de/myServices/showfile.php?highlight=userfriendly">source code.</a>";
echo $content;
?>
|
|