From c40958ca6c28a5789ec32b29e3906d0effd6bc94 Mon Sep 17 00:00:00 2001 From: Pickle Cillo Date: Sun, 23 May 2021 17:23:08 -0400 Subject: [PATCH] Fix setting basic auth for curl --- src/search.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/search.php b/src/search.php index 3304afb..c493979 100644 --- a/src/search.php +++ b/src/search.php @@ -17,8 +17,10 @@ function __construct ( $hostname, $port, $username, $password ) { public function search($query) { $wf = new Workflows(); - $baseUrl = "http://{$this->username}:{$this->password}@{$this->hostname}:{$this->port}"; - $json = $wf->request( $baseUrl."/notes/?limit=20&keyword=".urlencode( $query ) ); + $authOptions = [CURLOPT_USERPWD => "{$this->username}:{$this->password}"]; + + $baseUrl = "http://{$this->hostname}:{$this->port}"; + $json = $wf->request( $baseUrl."/notes/?limit=20&keyword=".urlencode( $query ) , $authOptions); $json = json_decode($json); $int = 1;