From: Philipp Holzer Date: Thu, 11 Oct 2018 05:40:57 +0000 (+0200) Subject: Bugfixing for CurlResult X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2e8d9ba39b30c9f8803ed85e25c19a1a509d1418;p=friendica-addons.git Bugfixing for CurlResult --- diff --git a/blogger/blogger.php b/blogger/blogger.php index e747c3a6..00563c3a 100644 --- a/blogger/blogger.php +++ b/blogger/blogger.php @@ -205,7 +205,7 @@ EOT; logger('blogger: data: ' . $xml, LOGGER_DATA); if ($bl_blog !== 'test') { - $x = Network::post($bl_blog, $xml); + $x = Network::post($bl_blog, $xml)->getBody(); } logger('posted to blogger: ' . (($x) ? $x : ''), LOGGER_DEBUG); diff --git a/dwpost/dwpost.php b/dwpost/dwpost.php index f6f26634..bc8959fc 100644 --- a/dwpost/dwpost.php +++ b/dwpost/dwpost.php @@ -228,7 +228,7 @@ EOT; logger('dwpost: data: ' . $xml, LOGGER_DATA); if ($dw_blog !== 'test') { - $x = Network::post($dw_blog, $xml, ["Content-Type: text/xml"]); + $x = Network::post($dw_blog, $xml, ["Content-Type: text/xml"])->getBody(); } logger('posted to dreamwidth: ' . ($x) ? $x : '', LOGGER_DEBUG); diff --git a/ijpost/ijpost.php b/ijpost/ijpost.php index 5d24509e..3dcfb31f 100644 --- a/ijpost/ijpost.php +++ b/ijpost/ijpost.php @@ -224,7 +224,7 @@ EOT; logger('ijpost: data: ' . $xml, LOGGER_DATA); if ($ij_blog !== 'test') { - $x = Network::post($ij_blog, $xml, ["Content-Type: text/xml"]); + $x = Network::post($ij_blog, $xml, ["Content-Type: text/xml"])->getBody(); } logger('posted to insanejournal: ' . $x ? $x : '', LOGGER_DEBUG); } diff --git a/libertree/libertree.php b/libertree/libertree.php index c6e3f9f1..aa4c48b7 100644 --- a/libertree/libertree.php +++ b/libertree/libertree.php @@ -231,7 +231,7 @@ function libertree_send(&$a,&$b) { // 'token' => $ltree_api_token ]; - $result = Network::post($ltree_blog, $params); + $result = Network::post($ltree_blog, $params)->getBody(); logger('libertree: ' . $result); } } diff --git a/ljpost/ljpost.php b/ljpost/ljpost.php index 61c96b7d..dfc1387b 100644 --- a/ljpost/ljpost.php +++ b/ljpost/ljpost.php @@ -234,7 +234,7 @@ EOT; logger('ljpost: data: ' . $xml, LOGGER_DATA); if ($lj_blog !== 'test') { - $x = Network::post($lj_blog, $xml, ["Content-Type: text/xml"]); + $x = Network::post($lj_blog, $xml, ["Content-Type: text/xml"])->getBody(); } logger('posted to livejournal: ' . ($x) ? $x : '', LOGGER_DEBUG); } diff --git a/mastodoncustomemojis/mastodoncustomemojis.php b/mastodoncustomemojis/mastodoncustomemojis.php index 5636af64..7df31112 100644 --- a/mastodoncustomemojis/mastodoncustomemojis.php +++ b/mastodoncustomemojis/mastodoncustomemojis.php @@ -89,10 +89,10 @@ function mastodoncustomemojis_fetch_custom_emojis_for_url($api_base_url) $api_url = $api_base_url . '/api/v1/custom_emojis'; - $ret = Network::fetchUrlFull($api_url); + $fetchResult = Network::fetchUrlFull($api_url); - if ($ret['success']) { - $emojis_array = json_decode($ret['body'], true); + if ($fetchResult->isSuccess()) { + $emojis_array = json_decode($fetchResult->getBody(), true); if (is_array($emojis_array) && count($emojis_array)) { foreach ($emojis_array as $emoji) { diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php index 83948360..0420591e 100644 --- a/openstreetmap/openstreetmap.php +++ b/openstreetmap/openstreetmap.php @@ -129,9 +129,9 @@ function openstreetmap_get_coordinates($a, &$b) $j = Cache::get($cachekey); if (is_null($j)) { - $x = Network::curl($nomserver . $args); - if ($x['success']) { - $j = json_decode($x['body'], true); + $curlResult = Network::curl($nomserver . $args); + if ($curlResult->isSuccess()) { + $j = json_decode($curlResult->getBody(), true); Cache::set($cachekey, $j, CACHE_MONTH); } } diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 4529ccd2..2bb52331 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -1691,8 +1691,7 @@ function pumpio_fetchallcomments(App $a, $uid, $id) function pumpio_reachable($url) { - $data = Network::curl($url, false, $redirects, ['timeout'=>10]); - return intval($data['return_code']) != 0; + return Network::curl($url, false, $redirects, ['timeout'=>10])->isSuccess(); } /* diff --git a/wppost/wppost.php b/wppost/wppost.php index d3e21949..76d928a2 100644 --- a/wppost/wppost.php +++ b/wppost/wppost.php @@ -315,7 +315,7 @@ EOT; logger('wppost: data: ' . $xml, LOGGER_DATA); if ($wp_blog !== 'test') { - $x = Network::post($wp_blog, $xml); + $x = Network::post($wp_blog, $xml)->getBody(); } logger('posted to wordpress: ' . (($x) ? $x : ''), LOGGER_DEBUG); }