
- NOTICE: config.default.php has changed, re-create your config.php!! - [fix] Footer no longer overlaps results - [fix] Search navigation no longer bunched up on smaller displays - [fix] Double search type when searching from start page - [new] Filter for additional/different headers per cURL request - [new] Image search via Openverse API (Access token and cronjob required, see installation instructions) - [new] Image search via Qwant API - [new] Web (recent news) search via Qwant API - [tweak] Merged 'cache' option into 'cache-type', see config.default.php for details - [tweak] Better filtering for duplicate web results - [tweak] File size formatting for images more uniform - [tweak] Optimized curl_multi_exec handling - [tweak] Improved SEO headers - [tweak] Layout tweaks and optimizations for search results, header and footer - [tweak] Removed redundant HTML, CSS and some PHP - [tweak] MagnetDL search disabled by default because of Cloudflare (Will probably be removed in future version) - [tweak] Removed non-functional magnet trackers - [tweak] Added 15 extra public magnet trackers - [change] Removed Ecosia support - [change] Removed Reddit support - [change] Removed 1337x support - [change] Removed MagnetDL support
59 lines
No EOL
2.1 KiB
PHP
59 lines
No EOL
2.1 KiB
PHP
<?php
|
|
/* ------------------------------------------------------------------------------------
|
|
* Goosle - A meta search engine for private and fast internet fun.
|
|
*
|
|
* COPYRIGHT NOTICE
|
|
* Copyright 2023-2024 Arnan de Gans. All Rights Reserved.
|
|
*
|
|
* COPYRIGHT NOTICES AND ALL THE COMMENTS SHOULD REMAIN INTACT.
|
|
* By using this code you agree to indemnify Arnan de Gans from any
|
|
* liability that might arise from its use.
|
|
------------------------------------------------------------------------------------ */
|
|
|
|
/*--------------------------------------
|
|
// Curl requests for oAUTH
|
|
--------------------------------------*/
|
|
function oath_curl_request($url, $user_agent, $method, $header, $post) {
|
|
$ch = curl_init();
|
|
|
|
curl_setopt($ch, CURLOPT_URL, $url);
|
|
if($method == "post") {
|
|
curl_setopt($ch, CURLOPT_POST, 1);
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
|
|
} else {
|
|
curl_setopt($ch, CURLOPT_HTTPGET, 1);
|
|
}
|
|
curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS | CURLPROTO_HTTP);
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
|
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
|
|
curl_setopt($ch, CURLOPT_ENCODING, "gzip,deflate");
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array_merge(array('Accept: application/json, */*;q=0.8'), $header));
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
|
curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
|
|
curl_setopt($ch, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS | CURLPROTO_HTTP);
|
|
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
|
|
curl_setopt($ch, CURLOPT_VERBOSE, false);
|
|
|
|
$response = curl_exec($ch);
|
|
curl_close($ch);
|
|
|
|
return json_decode($response, true);
|
|
}
|
|
|
|
/*--------------------------------------
|
|
// Store generated tokens
|
|
--------------------------------------*/
|
|
function oath_store_token($token_file, $connect, $token) {
|
|
if(!is_file($token_file)){
|
|
// Create token file
|
|
file_put_contents($token_file, serialize(array($connect => $token)));
|
|
} else {
|
|
// Update token file
|
|
$tokens = unserialize(file_get_contents($token_file));
|
|
$tokens[$connect] = $token;
|
|
file_put_contents($token_file, serialize($tokens));
|
|
}
|
|
}
|
|
|
|
?>
|