たまには PukiWiki などを
PukiWiki ならプラグインを書けばさくっと実現できるよねー。
わりと適当に。といっても一応キャッシュ機構ぐらいはつけてあるけど。
<?php define('PLUGIN_INCLUDEPAGE_USAGE', '#includepage(): Usage: #includepage(url[,class[,encoding]])'); define('PLUGIN_INCLUDEPAGE_CACHE_LIFETIME', 60 * 60); function plugin_includepage_convert() { $args = func_get_args(); if (!in_array(count($args), array(1, 2, 3))) { return PLUGIN_INCLUDEPAGE_USAGE; } $url = array_shift($args); if (!preg_match('#^http://#', $url)) { return PLUGIN_INCLUDEPAGE_USAGE; } if (count($args) >= 1) { $class = array_shift($args); } if (count($args) >= 1) { $encoding = array_shift($args); } else { $encoding = 'auto'; } $content = plugin_includepage_get_page_content($url); $content = mb_convert_encoding($content, SOURCE_ENCODING, $encoding); $escaped = htmlspecialchars($content); if (!empty($class)) { return sprintf('<pre class="%s">%s</pre>', htmlspecialchars($class, ENT_QUOTES), $escaped); } else { return sprintf('<pre>%s</pre>', $escaped); } } function plugin_includepage_get_page_content($url) { $filename = CACHE_DIR . DIRECTORY_SEPARATOR . 'includepage.' . md5($url); if (!file_exists($filename) or time() - filemtime($filename) > PLUGIN_INCLUDEPAGE_CACHE_LIFETIME) { $content = file_get_contents($url); plugin_includepage_write_file($filename, $content); return $content; } else { return file_get_contents($filename); } } function plugin_includepage_write_file($filename, $content) { $fp = fopen($filename, 'wb'); if (!$fp) { return FALSE; } fwrite($fp, $content); fclose($fp); return TRUE; } ?>