function google_search($q) { $rtrn = std_feed_parse(yubnubcmd('cmd2rss g ' . $q)); foreach ($rtrn['items'] as $id => $item) { $rtrn['items'][$id]['description'] = preg_replace('/<a[^\\f]*?<\\/a>/', '', $item['description']); $rtrn['items'][$id]['description'] = strip_tags($rtrn['items'][$id]['description']); if ($rtrn['items'][$id]['description'] == $rtrn['items'][$id]['title']) { $rtrn['items'][$id]['description'] = ''; } else { $rtrn['items'][$id]['description'] = substr($rtrn['items'][$id]['description'], 0, strlen($rtrn['items'][$id]['description']) - 6); } $rtrn['items'][$id]['title'] = html_entity_decode($item['title']); } //end foreach return $rtrn['items']; }
<b>From URL:</b> <form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?> "><div> Enter a URL: <input type="text" name="url" value="" /><br /> <input type="submit" name="submit" value="Convert" /> </div></form> <br /><br /> <b>From Data:</b> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> "><div> <textarea rows="15" cols="60" name="data"></textarea><br /> <input type="submit" name="submit" value="Convert" /> </div></form> <?php exit; } //end if !url||data if ($_REQUEST['url']) { $_REQUEST['data'] = file_get_contents($_REQUEST['url']); } require 'std_feed_parse.php'; $data = std_feed_parse($_REQUEST['data']); //RSS OUTPUT header('Content-Type: application/xml;charset=utf-8'); require 'std_rss_out.php'; echo std_rss_out($data);