Commit 3cab8029 authored by Karl Hasselbring's avatar Karl Hasselbring
Browse files

Es gab ein problem mit nicht ersetzten leerzeichen

parent a7aa037d
......@@ -5,7 +5,6 @@ namespace App\Http\Controllers;
use App;
use App\MetaGer;
use Illuminate\Http\Request;
use LaravelLocalization;
class MetaGerSearch extends Controller
{
......@@ -62,7 +61,7 @@ class MetaGerSearch extends Controller
public function get($url)
{
$ctx = stream_context_create(array('http'=>array('timeout' => 2,)));
$ctx = stream_context_create(array('http' => array('timeout' => 2)));
return file_get_contents($url, false, $ctx);
}
......
......@@ -13,6 +13,7 @@ class Quicktips
use DispatchesJobs;
const QUICKTIP_URL = "https://quicktips.metager3.de/quicktips.xml";
//const QUICKTIP_URL = "http://localhost:63825/quicktips.xml";
const QUICKTIP_NAME = "quicktips";
const CACHE_DURATION = 60;
......@@ -25,7 +26,7 @@ class Quicktips
public function startSearch($search, $locale, $max_time)
{
$url = self::QUICKTIP_URL . "?search=" . $search . "&locale=" . $locale;
$url = self::QUICKTIP_URL . "?search=" . $this->normalize_search($search) . "&locale=" . $locale;
$hash = md5($url);
......@@ -82,6 +83,7 @@ class Quicktips
Redis::hdel('search.' . $hash, self::QUICKTIP_NAME);
Cache::put($hash, $body, self::CACHE_DURATION);
#}
if ($body !== "") {
return $body;
} else {
......@@ -168,4 +170,10 @@ class Quicktips
return [];
}
}
public function normalize_search($search)
{
$search = str_replace(' ', '+', $search);
return $search;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment