<?php if ($_REQUEST['get']) { $_REQUEST['data'] = file_get_contents($_REQUEST['get']); } if (!$_REQUEST['data']) { header('Content-Type: text/plain'); header('Location: http://yubnub.org/kernel/man?args=mkrss', TRUE, 303); exit; } //end if ! data header('Content-Type: application/xml;charset=utf-8'); $_REQUEST['title'] = $_REQUEST['title'] ? $_REQUEST['title'] : ($_REQUEST['url'] ? $_REQUEST['url'] : 'A mkrss feed'); $_REQUEST['url'] = $_REQUEST['url'] ? $_REQUEST['url'] : 'http://yubnub.org/kernel/man?args=mkrss'; require 'yubnub2phparray.php'; $items = yubnub2phparray($_REQUEST['data']); echo '<?xml version="1.0" ?>' . "\n"; ?> <rss version="2.0"> <channel> <title><?php echo htmlspecialchars(iconv('', 'UTF-8', $_REQUEST['title'])); ?> </title> <link><?php echo htmlspecialchars(iconv('', 'UTF-8', $_REQUEST['url'])); ?> </link> <description>Powered by mkrss - a YubNub command</description> <docs>http://blogs.law.harvard.edu/tech/rss</docs> <generator>PHP script</generator>
<?php function yubnubcmd($cmd) { $curl = curl_init('http://yubnub.org/parser/parse?command=' . urlencode($cmd)); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); $rtrn = curl_exec($curl); curl_close($curl); return $rtrn; } //end function yubnubcmd header('Content-Type: text/plain;charset=utf-8'); require 'yubnub2phparray.php'; $items = yubnub2phparray(yubnubcmd('var ' . $_REQUEST['var'])); $items[] = $_REQUEST['append']; require 'php2yubnubarray.php'; echo yubnubcmd('var ' . $_REQUEST['var'] . ' -set ' . php2yubnubarray($items));