function wikigrabber($article) {
$wiki = 'http://en.wikipedia.org/wiki/';
$w = 'http://en.wikipedia.org/';
$article = str_replace(' ', '_', trim($article));
ini_set('user_agent', $_SERVER['HTTP_USER_AGENT']);
$content = file_get_contents($w . 'w/index.php?title=Special%3ASearch&go=Go&search=' . $article);
return "<font size=-1 color=\"#FF0000\">Article '" . $article . "' was not found.\n";
$search_end = '<div class="printfooter">';
// $search_link = '<link rel="stylesheet"';
$start = strpos($content, $search_start);
$end = strrpos($content, $search_end) - $start;
$linkpos = strpos($content, $search_link);
$embed = substr($content, $start, $end) . '</body>';
$embed = str_replace('"/wiki/', '"' . $_SERVER['PHP_SELF'] . '?article=', $embed);
$embed = str_replace('"/w/', '"' . $w . 'w/', $embed);
$embed = str_replace('style="width:22em;"', '', $embed);
$embed = str_replace('style="background:transparent; width:100%;"', '', $embed);
$embed = str_replace('td width="50%";"', 'td', $embed);
$embed = str_replace('width="400"', '', $embed);
$embed = str_replace('width:100%', 'td', $embed);
$embed = '<style type="text/css">
#column-content { margin-left: 0em }
#column-content #content { width: 600px; margin-left: 0em }
#p-logo a, #p-logo a:hover { width: 0em }
#p-cactions { left: 0em }
while($linkpos !== false && $linkpos < $start) {
$linkpos_end = strpos($content, "\n", $linkpos) - $linkpos;
$line = substr($content, $linkpos, $linkpos_end + 1);
if(strpos($content, '>' . $search_link, $linkpos - 1) != $linkpos - 1)
$embed = str_replace('"/', '"' . $w, $line) . $embed;
$linkpos = strpos($content, $search_link, $linkpos + $linkpos_end);
$embed = "<meta http-equiv=\"Content-Type\" content=\"text/html;\" charset=utf-8\">\n" . $embed;