From 56380864115d6df864edf80e43492bf890a75521 Mon Sep 17 00:00:00 2001 From: Fbenas Date: Sat, 5 Dec 2015 19:32:39 +0000 Subject: Allow use on other urls making password optional --- search.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'search.php') diff --git a/search.php b/search.php index bcfb2e9..370c25e 100644 --- a/search.php +++ b/search.php @@ -10,9 +10,13 @@ try { } // hash the password - $hash = hash("sha256", $config['password']); + if (isset($config['password'])) { + $hash = hash("sha256", $config['password']); + } $curl = curl_init($config["url"]. "?format=json"); - curl_setopt($curl, CURLOPT_HTTPHEADER, array("Cookie: password=$hash")); + if (isset($hash)) { + curl_setopt($curl, CURLOPT_HTTPHEADER, array("Cookie: password=$hash")); + } curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $output = json_decode(curl_exec($curl)); curl_close($curl); -- cgit v1.2.3