]> git.mxchange.org Git - friendica-addons.git/commitdiff
Rename DI::httpRequest() into DI::httpClient()
authorPhilipp <admin@philipp.info>
Wed, 25 Aug 2021 19:54:54 +0000 (21:54 +0200)
committerPhilipp <admin@philipp.info>
Wed, 25 Aug 2021 19:54:54 +0000 (21:54 +0200)
19 files changed:
blogger/blogger.php
curweather/curweather.php
discourse/discourse.php
dwpost/dwpost.php
geocoordinates/geocoordinates.php
geonames/geonames.php
ijpost/ijpost.php
jappixmini/jappixmini.php
leistungsschutzrecht/leistungsschutzrecht.php
libertree/libertree.php
ljpost/ljpost.php
mailstream/mailstream.php
mastodoncustomemojis/mastodoncustomemojis.php
nominatim/nominatim.php
openstreetmap/openstreetmap.php
pumpio/pumpio.php
statusnet/statusnet.php
twitter/twitter.php
wppost/wppost.php

index 38470f187e39a167659626300ed49ca37fc2dba8..37cdba091017a9f82ad31a7e86171622d035ba1d 100644 (file)
@@ -208,7 +208,7 @@ EOT;
                Logger::log('blogger: data: ' . $xml, Logger::DATA);
 
                if ($bl_blog !== 'test') {
-                       $x = DI::httpRequest()->post($bl_blog, $xml)->getBody();
+                       $x = DI::httpClient()->post($bl_blog, $xml)->getBody();
                }
 
                Logger::log('posted to blogger: ' . (($x) ? $x : ''), Logger::DEBUG);
index 2b8682d157168316df0a46ccb7641e6082867fd1..303fbbf942116290586c6d92c8e4e5044893b2c0 100644 (file)
@@ -41,7 +41,7 @@ function getWeather($loc, $units = 'metric', $lang = 'en', $appid = '', $cacheti
        }
 
        try {
-               $res = new SimpleXMLElement(DI::httpRequest()->fetch($url));
+               $res = new SimpleXMLElement(DI::httpClient()->fetch($url));
        } catch (Exception $e) {
                if (empty($_SESSION['curweather_notice_shown'])) {
                        notice(DI::l10n()->t('Error fetching weather data. Error was: ' . $e->getMessage()));
index f52edb9fb74597294cc1aa9127aead42e850e6ba..35ec9be52f416d3107ea9ecd865c1feb24bafe10 100644 (file)
@@ -114,7 +114,7 @@ function discourse_email_getmessage(App $a, &$message)
 function discourse_fetch_post($host, $topic, $pid)
 {
        $url = $host . '/t/' . $topic . '/' . $pid . '.json';
-       $curlResult = DI::httpRequest()->get($url);
+       $curlResult = DI::httpClient()->get($url);
        if (!$curlResult->isSuccess()) {
                Logger::info('No success', ['url' => $url]);
                return false;
@@ -151,7 +151,7 @@ function discourse_fetch_post_from_api(&$message, $post, $host)
 {
        $hostaddr = 'https://' . $host;
        $url = $hostaddr . '/posts/' . $post . '.json';
-       $curlResult = DI::httpRequest()->get($url);
+       $curlResult = DI::httpClient()->get($url);
        if (!$curlResult->isSuccess()) {
                return false;
        }
index 72e600ee6eaa5c097eb80eee111411aa2790bfd5..446f41d1e10ce398d87f73c1a486b514dd826793 100644 (file)
@@ -224,7 +224,7 @@ EOT;
                Logger::log('dwpost: data: ' . $xml, Logger::DATA);
 
                if ($dw_blog !== 'test') {
-                       $x = DI::httpRequest()->post($dw_blog, $xml, ['Content-Type' => 'text/xml'])->getBody();
+                       $x = DI::httpClient()->post($dw_blog, $xml, ['Content-Type' => 'text/xml'])->getBody();
                }
 
                Logger::log('posted to dreamwidth: ' . ($x) ? $x : '', Logger::DEBUG);
index 937e2f8c195b53e138b4b51b26ecf816e0ec5897..e892c25811512b4d365a9bbd80f10e0a3229437b 100644 (file)
@@ -45,7 +45,7 @@ function geocoordinates_resolve_item(&$item)
                return;
        }
 
-       $s = DI::httpRequest()->fetch("https://api.opencagedata.com/geocode/v1/json?q=" . $coords[0] . "," . $coords[1] . "&key=" . $key . "&language=" . $language);
+       $s = DI::httpClient()->fetch("https://api.opencagedata.com/geocode/v1/json?q=" . $coords[0] . "," . $coords[1] . "&key=" . $key . "&language=" . $language);
 
        if (!$s) {
                Logger::log("API could not be queried", Logger::DEBUG);
index cf5425889b339304e47a6540f8c2abeeff8c268d..052c416fced6a19b81b994a9265d8b8c01d14cab 100644 (file)
@@ -77,7 +77,7 @@ function geonames_post_hook(App $a, array &$item)
 
        /* OK, we're allowed to do our stuff. */
 
-       $s = DI::httpRequest()->fetch('http://api.geonames.org/findNearbyPlaceName?lat=' . $coords[0] . '&lng=' . $coords[1] . '&username=' . $geo_account);
+       $s = DI::httpClient()->fetch('http://api.geonames.org/findNearbyPlaceName?lat=' . $coords[0] . '&lng=' . $coords[1] . '&username=' . $geo_account);
 
        if (!$s) {
                return;
index cbd7e9b0d33ccdb129feb8616d4ccb50dbeffb8f..b9b4e2f861b468b94203e614320e03f041e27c20 100644 (file)
@@ -219,7 +219,7 @@ EOT;
                Logger::log('ijpost: data: ' . $xml, Logger::DATA);
 
                if ($ij_blog !== 'test') {
-                       $x = DI::httpRequest()->post($ij_blog, $xml, ['Content-Type' => 'text/xml'])->getBody();
+                       $x = DI::httpClient()->post($ij_blog, $xml, ['Content-Type' => 'text/xml'])->getBody();
                }
                Logger::log('posted to insanejournal: ' . $x ? $x : '', Logger::DEBUG);
        }
index 0e0abfc89aa1e787f4198739827ce7a222918a3e..f1cfed7799af2278db7e99db3b7eea69a4040f93 100644 (file)
@@ -644,7 +644,7 @@ function jappixmini_cron(App $a, $d)
 
                        try {
                                // send request
-                               $answer_json = DI::httpRequest()->fetch($url);
+                               $answer_json = DI::httpClient()->fetch($url);
 
                                // parse answer
                                $answer = json_decode($answer_json);
index 04bbd47417a2c7dccc90c9fe3911d45bd420ecb2..8d00f1dd2659e2003a5441a33b859bc7702657a5 100644 (file)
@@ -72,7 +72,7 @@ function leistungsschutzrecht_fetchsites()
 {
        // This list works - but question is how current it is
        $url = "http://leistungsschutzrecht-stoppen.d-64.org/blacklist.txt";
-       $sitelist = DI::httpRequest()->fetch($url);
+       $sitelist = DI::httpClient()->fetch($url);
        $siteurls = explode(',', $sitelist);
 
        $whitelist = ['tagesschau.de', 'heute.de', 'wdr.de'];
index a38a858244cf8e097256944e6c2334e8540cef39..969b4b401b08cb2462ff1714ffbd5ff4d8bd4ff8 100644 (file)
@@ -235,7 +235,7 @@ function libertree_send(&$a,&$b) {
                //      'token' => $ltree_api_token
                ];
 
-               $result = DI::httpRequest()->post($ltree_blog, $params)->getBody();
+               $result = DI::httpClient()->post($ltree_blog, $params)->getBody();
                Logger::log('libertree: ' . $result);
        }
 }
index 896099d81d753c4ec7e55dc0cbcabd6021a440f7..817eb59e0681d8054fe63b726abc8b8136debc5b 100644 (file)
@@ -234,7 +234,7 @@ EOT;
                Logger::log('ljpost: data: ' . $xml, Logger::DATA);
 
                if ($lj_blog !== 'test') {
-                       $x = DI::httpRequest()->post($lj_blog, $xml, ['Content-Type' => 'text/xml'])->getBody();
+                       $x = DI::httpClient()->post($lj_blog, $xml, ['Content-Type' => 'text/xml'])->getBody();
                }
                Logger::log('posted to livejournal: ' . ($x) ? $x : '', Logger::DEBUG);
        }
index a9fbc2b41c10d4df162098eb3dac8ffb17d0b180..0e5abcd481397084b9522766be69496b913f7806 100644 (file)
@@ -204,7 +204,7 @@ function mailstream_do_images(&$item, &$attachments)
                        continue;
                }
                $cookiejar = tempnam(get_temppath(), 'cookiejar-mailstream-');
-               $curlResult = DI::httpRequest()->fetchFull($url, 0, '', $cookiejar);
+               $curlResult = DI::httpClient()->fetchFull($url, 0, '', $cookiejar);
                $attachments[$url] = [
                        'data' => $curlResult->getBody(),
                        'guid' => hash("crc32", $url),
index eeada86256dd361267f359812252d7ecfb721f0e..b6b1cfd3c3df83252c149ab0c480d7bd53969a54 100644 (file)
@@ -79,7 +79,7 @@ function mastodoncustomemojis_fetch_custom_emojis_for_url($api_base_url)
 
        $api_url = $api_base_url . '/api/v1/custom_emojis';
 
-       $fetchResult = DI::httpRequest()->fetchFull($api_url);
+       $fetchResult = DI::httpClient()->fetchFull($api_url);
 
        if ($fetchResult->isSuccess()) {
                $emojis_array = json_decode($fetchResult->getBody(), true);
index 45f5042bef85188fe558f7265c92c78007d75031..70d3e5088b037ff6af6d33a123dc15e183379ba3 100644 (file)
@@ -43,7 +43,7 @@ function nominatim_resolve_item(&$item)
                return;
        }
 
-       $s = DI::httpRequest()->fetch('https://nominatim.openstreetmap.org/reverse?lat=' . $coords[0] . '&lon=' . $coords[1] . '&format=json&addressdetails=0&accept-language=' . $language);
+       $s = DI::httpClient()->fetch('https://nominatim.openstreetmap.org/reverse?lat=' . $coords[0] . '&lon=' . $coords[1] . '&format=json&addressdetails=0&accept-language=' . $language);
        if (empty($s)) {
                Logger::info('API could not be queried');
                return;
index 08111a0c873bbab722aa07a3cb5e855333852989..d1217597e07fb6a4708759bcb1646320451e5234 100644 (file)
@@ -119,7 +119,7 @@ function openstreetmap_get_coordinates($a, &$b)
        $j = DI::cache()->get($cachekey);
 
        if (is_null($j)) {
-               $curlResult = DI::httpRequest()->get($nomserver . $args);
+               $curlResult = DI::httpClient()->get($nomserver . $args);
                if ($curlResult->isSuccess()) {
                        $j = json_decode($curlResult->getBody(), true);
                        DI::cache()->set($cachekey, $j, Duration::MONTH);
index bf6bfda367e27e2b4d38d4b5561023ae1d4c7bba..f76e40fe403e4e802fe1437d2e2294b208318be3 100644 (file)
@@ -1594,7 +1594,7 @@ function pumpio_fetchallcomments(App $a, $uid, $id)
 
 function pumpio_reachable($url)
 {
-       return DI::httpRequest()->get($url, [HTTPClientOptions::TIMEOUT => 10])->isSuccess();
+       return DI::httpClient()->get($url, [HTTPClientOptions::TIMEOUT => 10])->isSuccess();
 }
 
 /*
index 1a3ba1f9785049d1837d5d9ebde8bea8640a714e..6c7aec92f82e2cc17f04f202a504d6ca3c9a0680 100644 (file)
@@ -136,7 +136,7 @@ function statusnet_settings_post(App $a, $post)
                        foreach ($globalsn as $asn) {
                                if ($asn['apiurl'] == $_POST['statusnet-preconf-apiurl']) {
                                        $apibase = $asn['apiurl'];
-                                       $c = DI::httpRequest()->fetch($apibase . 'statusnet/version.xml');
+                                       $c = DI::httpClient()->fetch($apibase . 'statusnet/version.xml');
                                        if (strlen($c) > 0) {
                                                DI::pConfig()->set(local_user(), 'statusnet', 'consumerkey', $asn['consumerkey']);
                                                DI::pConfig()->set(local_user(), 'statusnet', 'consumersecret', $asn['consumersecret']);
@@ -154,7 +154,7 @@ function statusnet_settings_post(App $a, $post)
                                //  we'll check the API Version for that, if we don't get one we'll try to fix the path but will
                                //  resign quickly after this one try to fix the path ;-)
                                $apibase = $_POST['statusnet-baseapi'];
-                               $c = DI::httpRequest()->fetch($apibase . 'statusnet/version.xml');
+                               $c = DI::httpClient()->fetch($apibase . 'statusnet/version.xml');
                                if (strlen($c) > 0) {
                                        //  ok the API path is correct, let's save the settings
                                        DI::pConfig()->set(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']);
@@ -164,7 +164,7 @@ function statusnet_settings_post(App $a, $post)
                                } else {
                                        //  the API path is not correct, maybe missing trailing / ?
                                        $apibase = $apibase . '/';
-                                       $c = DI::httpRequest()->fetch($apibase . 'statusnet/version.xml');
+                                       $c = DI::httpClient()->fetch($apibase . 'statusnet/version.xml');
                                        if (strlen($c) > 0) {
                                                //  ok the API path is now correct, let's save the settings
                                                DI::pConfig()->set(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']);
@@ -597,7 +597,7 @@ function statusnet_post_hook(App $a, &$b)
                }
 
                if ($image != "") {
-                       $img_str = DI::httpRequest()->fetch($image);
+                       $img_str = DI::httpClient()->fetch($image);
                        $tempfile = tempnam(get_temppath(), "cache");
                        file_put_contents($tempfile, $img_str);
                        $postdata = ["status" => $msg, "media[]" => $tempfile];
@@ -1426,7 +1426,7 @@ function statusnet_convertmsg(App $a, $body)
 
                        Logger::log("statusnet_convertmsg: expanding url " . $match[1], Logger::DEBUG);
 
-                       $expanded_url = DI::httpRequest()->finalUrl($match[1]);
+                       $expanded_url = DI::httpClient()->finalUrl($match[1]);
 
                        Logger::log("statusnet_convertmsg: fetching data for " . $expanded_url, Logger::DEBUG);
 
@@ -1450,7 +1450,7 @@ function statusnet_convertmsg(App $a, $body)
                        } elseif ($oembed_data->type != "link") {
                                $body = str_replace($search, "[url=" . $expanded_url . "]" . $expanded_url . "[/url]", $body);
                        } else {
-                               $img_str = DI::httpRequest()->fetch($expanded_url, 4);
+                               $img_str = DI::httpClient()->fetch($expanded_url, 4);
 
                                $tempfile = tempnam(get_temppath(), "cache");
                                file_put_contents($tempfile, $img_str);
index 0cf5637e3e8375bd53e2efd8433763567f8dd29d..fe196e3eeb3db7a9883db93a9794794b6c908330 100644 (file)
@@ -702,7 +702,7 @@ function twitter_post_hook(App $a, array &$b)
                                                continue;
                                        }
 
-                                       $img_str = DI::httpRequest()->fetch($image['url']);
+                                       $img_str = DI::httpClient()->fetch($image['url']);
 
                                        $tempfile = tempnam(get_temppath(), 'cache');
                                        file_put_contents($tempfile, $img_str);
index 637394d84e673fa58d30cf0ab7cac8d4077f1cbf..825593ae26c8a9c5fde25e5a18775e834bacffdc 100644 (file)
@@ -325,7 +325,7 @@ EOT;
                Logger::log('wppost: data: ' . $xml, Logger::DATA);
 
                if ($wp_blog !== 'test') {
-                       $x = DI::httpRequest()->post($wp_blog, $xml)->getBody();
+                       $x = DI::httpClient()->post($wp_blog, $xml)->getBody();
                }
                Logger::log('posted to wordpress: ' . (($x) ? $x : ''), Logger::DEBUG);
        }