request("$url[path]$url[query]"); ob_start(); $mime = explode(';', $response->getMeta())[0]; if (strpos($mime, 'text/gemini') === 0) { $parser = new Gemtext($response->getBody()); $lines = $parser->parse(); $wasListItem = false; $currentListItems = []; foreach ($lines as $line) { if ($wasListItem && $line['type'] !== 'listitem') { echo "
"; } else if ($line['type'] === 'preformatted') { echo htmlentities($line['raw']); } else if ($line['type'] === 'preformatted_off') { echo ""; } else if ($line['type'] === 'heading') { echo "
$line[text]"; } else if ($line['type'] === 'link') { $line['link'] = str_replace(["gemini://$geminiHost", $geminiHost], "https://$geminiHost", $line['link']); $line['text'] = $line['text'] ?: $line['link']; echo "$line[text]"; } else if ($line['type'] === 'text') { echo "
$line[text]
"; } } } else if (strpos($mime, 'image') === 0) { echo "getBody()) . "\">"; } echo "