Files
FrogFindMobile/about.php
Action Retro c296667784 Initial commit
2021-04-03 18:42:05 -04:00

97 lines
5.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
require_once('vendor/autoload.php');
$show_results = FALSE;
$results_html = "";
$final_result_html = "<hr>";
if(isset( $_GET['q'])) { // if there's a search query, show the results for it
$query = urlencode($_GET["q"]);
$show_results = TRUE;
$search_url = "https://html.duckduckgo.com/html?q=" . $query;
if(!$results_html = file_get_contents($search_url)) {
$error_text .= "Failed to get results, sorry :( <br>";
}
$simple_results=$results_html;
//$simple_results= strip_tags($results_html, '<a><ol><ul><li><br><p><small><font><b><strong><i><em><blockquote><h1><h2><h3><h4><h5><h6>');
$simple_results = str_replace( 'strong>', 'b>', $simple_results ); //change <strong> to <b>
$simple_results = str_replace( 'em>', 'i>', $simple_results ); //change <em> to <i>
$simple_results = clean_str($simple_results);
$result_blocks = explode('<h2 class="result__title">', $simple_results);
$total_results = count($result_blocks)-1;
for ($x = 1; $x <= $total_results; $x++) {
if(strpos($result_blocks[$x], '<a class="badge--ad">')===false) { //only return non ads
// result link, redirected through our proxy
$result_link = explode('class="result__a" href="', $result_blocks[$x])[1];
$result_topline = explode('">', $result_link);
$result_link = str_replace( '//duckduckgo.com/l/?uddg=', '/read.php?a=', $result_topline[0]);
// result title
$result_title = str_replace("</a>","",explode("\n", $result_topline[1]));
// result display url
$result_display_url = explode('class="result__url"', $result_blocks[$x])[1];
$result_display_url = trim(explode("\n", $result_display_url)[1]);
// result snippet
$result_snippet = explode('class="result__snippet"', $result_blocks[$x])[1];
$result_snippet = explode('">', $result_snippet)[1];
$result_snippet = explode('</a>', $result_snippet)[0];
$final_result_html .= "<br><a href='" . $result_link . "'><font size='4'><b>" . $result_title[0] . "</b></font><br><font color='#008000' size='2'>"
. $result_display_url . "</font></a><br>" . $result_snippet . "<br><br><hr>";
// if($x==$total_results) {
// $last_result = explode('<div class="nav-link">', $result_blocks[$x]);
// $final_result_html .= $last_result[0];
// } else {
// $final_result_html .= $result_blocks[$x] . "<hr>";
// }
}
}
//$final_result_html = str_replace( '//duckduckgo.com/l/?uddg=', '/read.php?a=', $final_result_html);
}
//replace chars that old machines probably can't handle
function clean_str($str) {
$str = str_replace( "", "'", $str );
$str = str_replace( "", "'", $str );
$str = str_replace( "", '"', $str );
$str = str_replace( "", '"', $str );
$str = str_replace( "", '-', $str );
$str = str_replace( "&#x27;", "'", $str );
return $str;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 2.0//EN">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<html>
<head>
<title>FrogFind!</title>
</head>
<body>
<form action="/" method="get">
<a href="/"><font size=6 color="#008000">Frog</font><font size=6 color="#000000">Find!</font></a> Leap again: <input type="text" size="30" name="q" value="<?php echo urldecode($query) ?>">
<input type="submit" value="Ribbbit!">
</form>
<hr>
<br>
<center>
<h1>What in the world is FrogFind?</h1>
<small>A quick FAQ on an unconventional search engine</small>
</center>
<br>
<h3>Who made FrogFind?</h3>
Hi, I'm Sean, A.K.A. <a href="https://youtube.com/ActionRetro">Action Retro</a> on YouTube. I work on a lot of 80's and 90's Macs (and other vintage machines), and I really like to try and get them online. However, the modern internet is not kind to old machines, which generally cannot handle the complicated javascript, CSS, and encryption that modern sites have. However, they can browse basic websites just fine. So I decided to see how much of the internet I could turn into basic websites, so that old machines can browse the modern internet once again!
<h3>How does FrogFind work?</h3>
The search functionality of FrogFind is basically a custom wrapper for DuckDuckGo search, converting the results to extremely basic HTML that old browsers can read. When clicking through to pages from search results, those pages are processed through a <a href="https://github.com/andreskrey/readability.php" target="_blank">PHP port of Mozilla's Readability</a>, which is what powers Firefox's reader mode. I then further strip down the results to be as basic HTML as possible.
<h3>What machines do you test FrogFind on?</h3>
I designed FrogFind with classic Macs in mind, so I've been testing on my SE/30 to make sure it looks good in 1 bit color with a 512x384 resolution. Most of my testing has been on Netscape 1.1N and 2.0.2, as well as a few 68k Mac versions of iCab. FrogFind should also work great on any text-based web browser!
<h3>How can I get in touch with you?</h3>
Send me an email! <a href="mailto:actionretro@pm.me">actionretro@pm.me</a>
</body>
</html>