From 688c556739ce4b55fac78c574a0b16154411049c Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Wed, 4 Mar 2020 22:15:45 +0100 Subject: [PATCH] Make "HTTPRequest::curl" dynamic --- discourse/discourse.php | 5 ++--- openstreetmap/openstreetmap.php | 3 +-- pumpio/pumpio.php | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/discourse/discourse.php b/discourse/discourse.php index 06b86677..5e64c173 100644 --- a/discourse/discourse.php +++ b/discourse/discourse.php @@ -17,7 +17,6 @@ use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Contact; -use Friendica\Network\HTTPRequest; use Friendica\Util\DateTimeFormat; use Friendica\Util\Strings; @@ -115,7 +114,7 @@ function discourse_email_getmessage(App $a, &$message) function discourse_fetch_post($host, $topic, $pid) { $url = $host . '/t/' . $topic . '/' . $pid . '.json'; - $curlResult = HTTPRequest::curl($url); + $curlResult = DI::httpRequest()->curl($url); if (!$curlResult->isSuccess()) { Logger::info('No success', ['url' => $url]); return false; @@ -152,7 +151,7 @@ function discourse_fetch_post_from_api(&$message, $post, $host) { $hostaddr = 'https://' . $host; $url = $hostaddr . '/posts/' . $post . '.json'; - $curlResult = HTTPRequest::curl($url); + $curlResult = DI::httpRequest()->curl($url); if (!$curlResult->isSuccess()) { return false; } diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php index 370eb910..ede71ccd 100644 --- a/openstreetmap/openstreetmap.php +++ b/openstreetmap/openstreetmap.php @@ -14,7 +14,6 @@ use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\DI; -use Friendica\Network\HTTPRequest; use Friendica\Util\ConfigFileLoader; use Friendica\Util\Strings; @@ -132,7 +131,7 @@ function openstreetmap_get_coordinates($a, &$b) $j = DI::cache()->get($cachekey); if (is_null($j)) { - $curlResult = HTTPRequest::curl($nomserver . $args); + $curlResult = DI::httpRequest()->curl($nomserver . $args); if ($curlResult->isSuccess()) { $j = json_decode($curlResult->getBody(), true); DI::cache()->set($cachekey, $j, Duration::MONTH); diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index c58667b2..d8590284 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -19,7 +19,6 @@ use Friendica\Model\Contact; use Friendica\Model\Group; use Friendica\Model\Item; use Friendica\Model\User; -use Friendica\Network\HTTPRequest; use Friendica\Protocol\Activity; use Friendica\Protocol\ActivityNamespace; use Friendica\Util\ConfigFileLoader; @@ -1605,7 +1604,7 @@ function pumpio_fetchallcomments(App $a, $uid, $id) function pumpio_reachable($url) { - return HTTPRequest::curl($url, false, ['timeout' => 10])->isSuccess(); + return DI::httpRequest()->curl($url, false, ['timeout' => 10])->isSuccess(); } /* -- 2.39.5