]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Search.php
Merge pull request #11015 from MrPetovan/task/10979-frio-time-tooltip
[friendica.git] / src / Core / Search.php
index 8138c5763f63d945d5f2589b10240b1023e5eabd..82c0ea3d36c3b0cb159ff2febb0465e76098fbca 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -24,6 +24,7 @@ namespace Friendica\Core;
 use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Network\HTTPException;
+use Friendica\Network\HTTPClient\Client\HttpClientOptions;
 use Friendica\Object\Search\ContactResult;
 use Friendica\Object\Search\ResultList;
 use Friendica\Util\Network;
@@ -121,7 +122,7 @@ class Search
                        $searchUrl .= '&page=' . $page;
                }
 
-               $resultJson = DI::httpRequest()->fetch($searchUrl, 0, 'application/json');
+               $resultJson = DI::httpClient()->fetch($searchUrl, 0, 'application/json');
 
                $results = json_decode($resultJson, true);
 
@@ -134,7 +135,7 @@ class Search
                $profiles = $results['profiles'] ?? [];
 
                foreach ($profiles as $profile) {
-                       $profile_url = $profile['url'] ?? '';
+                       $profile_url = $profile['profile_url'] ?? '';
                        $contactDetails = Contact::getByURLForUser($profile_url, local_user());
 
                        $result = new ContactResult(
@@ -227,7 +228,7 @@ class Search
                        $return = Contact::searchByName($search, $mode);
                } else {
                        $p = $page > 1 ? 'p=' . $page : '';
-                       $curlResult = DI::httpRequest()->get(self::getGlobalDirectory() . '/search/people?' . $p . '&q=' . urlencode($search), ['accept_content' => 'application/json']);
+                       $curlResult = DI::httpClient()->get(self::getGlobalDirectory() . '/search/people?' . $p . '&q=' . urlencode($search), [HttpClientOptions::ACCEPT_CONTENT => ['application/json']]);
                        if ($curlResult->isSuccess()) {
                                $searchResult = json_decode($curlResult->getBody(), true);
                                if (!empty($searchResult['profiles'])) {