]> git.mxchange.org Git - friendica.git/commitdiff
Move z_fetch_url
authorAdam Magness <adam.magness@gmail.com>
Sat, 27 Jan 2018 04:18:38 +0000 (23:18 -0500)
committerAdam Magness <adam.magness@gmail.com>
Sat, 27 Jan 2018 04:18:38 +0000 (23:18 -0500)
move z_fetch_url method

14 files changed:
include/acl_selectors.php
include/network.php
mod/ostatus_subscribe.php
mod/parse_url.php
src/Model/GContact.php
src/Network/Probe.php
src/Protocol/DFRN.php
src/Protocol/OStatus.php
src/Protocol/PortableContact.php
src/Util/ExAuth.php
src/Util/Network.php
src/Util/ParseUrl.php
src/Worker/DiscoverPoCo.php
src/Worker/OnePoll.php

index 599b543ad0ee9fe76efccd897307c5a32a53d6a6..38a418dd1cd94020fdd9ce8ee62882be4ec526fb 100644 (file)
@@ -11,6 +11,7 @@ use Friendica\Core\L10n;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\GContact;
+use Friendica\Util\Network;
 
 require_once "mod/proxy.php";
 
@@ -733,7 +734,7 @@ function navbar_complete(App $a) {
        if (! $localsearch) {
                $p = (($a->pager['page'] != 1) ? '&p=' . $a->pager['page'] : '');
 
-               $x = z_fetch_url(get_server() . '/lsearch?f=' . $p .  '&search=' . urlencode($search));
+               $x = Network::zFetchURL(get_server() . '/lsearch?f=' . $p .  '&search=' . urlencode($search));
                if ($x['success']) {
                        $j = json_decode($x['body'],true);
                        if ($j && isset($j['results'])) {
index f6a864a635444a275c8b7bd8af6d4ec3f6e3b666..7f1bbb6d83b7463499191f46380f048a0b55f1da 100644 (file)
@@ -12,16 +12,6 @@ use Friendica\Object\Image;
 use Friendica\Util\Network;
 use Friendica\Util\XML;
 
-function fetch_url($url, $binary = false, &$redirects = 0, $timeout = 0, $accept_content = null, $cookiejar = 0)
-{
-       return Network::fetchURL($url, $binary, $redirects, $timeout, $accept_content, $cookiejar);
-}
-
-function z_fetch_url($url, $binary = false, &$redirects = 0, $opts = [])
-{
-       return Network::zFetchURL($url, $binary, $redirects, $opts);
-}
-
 function post_url($url, $params, $headers = null, &$redirects = 0, $timeout = 0)
 {
        return Network::postURL($url, $params, $headers, $redirects, $timeout);
index 295ccfee61ebc5072484df6b9880ae133018c89a..81eced22e7cb0e12ca716e1e1ba298b7805549cd 100644 (file)
@@ -8,6 +8,7 @@ use Friendica\Core\PConfig;
 use Friendica\Core\System;
 use Friendica\Model\Contact;
 use Friendica\Network\Probe;
+use Friendica\Util\Network;
 
 function ostatus_subscribe_content(App $a) {
 
@@ -40,7 +41,7 @@ function ostatus_subscribe_content(App $a) {
                $api = $contact["baseurl"]."/api/";
 
                // Fetching friends
-               $data = z_fetch_url($api."statuses/friends.json?screen_name=".$contact["nick"]);
+               $data = Network::zFetchURL($api."statuses/friends.json?screen_name=".$contact["nick"]);
 
                if (!$data["success"]) {
                        return $o.L10n::t("Couldn't fetch friends for contact.");
index 6fb404f1b052f9714d9afb9ff2f62c87872570b0..f1214e160f1267ab3d39dded5a3235f66d09b025 100644 (file)
@@ -12,6 +12,7 @@
 
 use Friendica\App;
 use Friendica\Core\Addon;
+use Friendica\Util\Network;
 use Friendica\Util\ParseUrl;
 
 require_once("include/items.php");
@@ -60,7 +61,7 @@ function parse_url_content(App $a) {
        // the URL with the corresponding BBCode media tag
        $redirects = 0;
        // Fetch the header of the URL
-       $result = z_fetch_url($url, false, $redirects, ["novalidate" => true, "nobody" => true]);
+       $result = Network::zFetchURL($url, false, $redirects, ["novalidate" => true, "nobody" => true]);
        if($result["success"]) {
                // Convert the header fields into an array
                $hdrs = [];
index 28c872f32c195ed872ff593c78cc863875eaa7dd..231970820f99c32c081aeaf221f563b7e08d08ce 100644 (file)
@@ -981,7 +981,7 @@ class GContact
 
                $url = $server."/main/statistics";
 
-               $result = z_fetch_url($url);
+               $result = Network::zFetchURL($url);
                if (!$result["success"]) {
                        return false;
                }
index 2cc855216b000429e6d480ea42fbe0749251c984..94fd929e107b1c4d52575d42011e23d4c48e28ec 100644 (file)
@@ -18,6 +18,7 @@ use Friendica\Model\Profile;
 use Friendica\Protocol\Email;
 use Friendica\Protocol\Feed;
 use Friendica\Util\Crypto;
+use Friendica\Util\Network;
 use Friendica\Util\XML;
 
 use dba;
@@ -107,7 +108,7 @@ class Probe
 
                logger("Probing for ".$host, LOGGER_DEBUG);
 
-               $ret = z_fetch_url($ssl_url, false, $redirects, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']);
+               $ret = Network::zFetchURL($ssl_url, false, $redirects, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']);
                if ($ret['success']) {
                        $xml = $ret['body'];
                        $xrd = parse_xml_string($xml, false);
@@ -115,7 +116,7 @@ class Probe
                }
 
                if (!is_object($xrd)) {
-                       $ret = z_fetch_url($url, false, $redirects, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']);
+                       $ret = Network::zFetchURL($url, false, $redirects, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']);
                        if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
                                logger("Probing timeout for ".$url, LOGGER_DEBUG);
                                return false;
@@ -692,7 +693,7 @@ class Probe
                $xrd_timeout = Config::get('system', 'xrd_timeout', 20);
                $redirects = 0;
 
-               $ret = z_fetch_url($url, false, $redirects, ['timeout' => $xrd_timeout, 'accept_content' => $type]);
+               $ret = Network::zFetchURL($url, false, $redirects, ['timeout' => $xrd_timeout, 'accept_content' => $type]);
                if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
                        return false;
                }
@@ -759,7 +760,7 @@ class Probe
         */
        private static function pollNoscrape($noscrape_url, $data)
        {
-               $ret = z_fetch_url($noscrape_url);
+               $ret = Network::zFetchURL($noscrape_url);
                if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
                        return false;
                }
@@ -993,7 +994,7 @@ class Probe
         */
        private static function pollHcard($hcard_url, $data, $dfrn = false)
        {
-               $ret = z_fetch_url($hcard_url);
+               $ret = Network::zFetchURL($hcard_url);
                if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
                        return false;
                }
@@ -1232,7 +1233,7 @@ class Probe
                                                        $pubkey = substr($pubkey, 5);
                                                }
                                        } elseif (normalise_link($pubkey) == 'http://') {
-                                               $ret = z_fetch_url($pubkey);
+                                               $ret = Network::zFetchURL($pubkey);
                                                if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
                                                        return false;
                                                }
@@ -1264,7 +1265,7 @@ class Probe
                }
 
                // Fetch all additional data from the feed
-               $ret = z_fetch_url($data["poll"]);
+               $ret = Network::zFetchURL($data["poll"]);
                if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
                        return false;
                }
@@ -1448,7 +1449,7 @@ class Probe
         */
        private static function feed($url, $probe = true)
        {
-               $ret = z_fetch_url($url);
+               $ret = Network::zFetchURL($url);
                if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
                        return false;
                }
index 808e8aaa2a652dde6665da0b8748fb70d3b2bca8..4289769e4117ee5af4535631d2979dd576b0958f 100644 (file)
@@ -25,6 +25,7 @@ use Friendica\Model\User;
 use Friendica\Object\Image;
 use Friendica\Protocol\OStatus;
 use Friendica\Util\Crypto;
+use Friendica\Util\Network;
 use Friendica\Util\XML;
 
 use dba;
@@ -1186,7 +1187,7 @@ class DFRN
 
                logger('dfrn_deliver: ' . $url);
 
-               $ret = z_fetch_url($url);
+               $ret = Network::zFetchURL($url);
 
                if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
                        return -2; // timed out
index 3b04a11d275a1f71034ac41e203b77bd41fb01c4..87b894a717a60d48e528523562859cf0ac37d8e2 100644 (file)
@@ -17,6 +17,7 @@ use Friendica\Model\Conversation;
 use Friendica\Network\Probe;
 use Friendica\Object\Image;
 use Friendica\Util\Lock;
+use Friendica\Util\Network;
 use Friendica\Util\XML;
 use dba;
 use DOMDocument;
@@ -725,7 +726,7 @@ class OStatus
 
                self::$conv_list[$conversation] = true;
 
-               $conversation_data = z_fetch_url($conversation, false, $redirects, ['accept_content' => 'application/atom+xml, text/html']);
+               $conversation_data = Network::zFetchURL($conversation, false, $redirects, ['accept_content' => 'application/atom+xml, text/html']);
 
                if (!$conversation_data['success']) {
                        return;
@@ -753,7 +754,7 @@ class OStatus
                                        }
                                }
                                if ($file != '') {
-                                       $conversation_atom = z_fetch_url($attribute['href']);
+                                       $conversation_atom = Network::zFetchURL($attribute['href']);
 
                                        if ($conversation_atom['success']) {
                                                $xml = $conversation_atom['body'];
@@ -869,7 +870,7 @@ class OStatus
                        return;
                }
 
-               $self_data = z_fetch_url($self);
+               $self_data = Network::zFetchURL($self);
 
                if (!$self_data['success']) {
                        return;
@@ -914,7 +915,7 @@ class OStatus
                }
 
                $stored = false;
-               $related_data = z_fetch_url($related, false, $redirects, ['accept_content' => 'application/atom+xml, text/html']);
+               $related_data = Network::zFetchURL($related, false, $redirects, ['accept_content' => 'application/atom+xml, text/html']);
 
                if (!$related_data['success']) {
                        return;
@@ -945,7 +946,7 @@ class OStatus
                                        }
                                }
                                if ($atom_file != '') {
-                                       $related_atom = z_fetch_url($atom_file);
+                                       $related_atom = Network::zFetchURL($atom_file);
 
                                        if ($related_atom['success']) {
                                                logger('Fetched XML for URI '.$related_uri, LOGGER_DEBUG);
@@ -957,7 +958,7 @@ class OStatus
 
                // Workaround for older GNU Social servers
                if (($xml == '') && strstr($related, '/notice/')) {
-                       $related_atom = z_fetch_url(str_replace('/notice/', '/api/statuses/show/', $related).'.atom');
+                       $related_atom = Network::zFetchURL(str_replace('/notice/', '/api/statuses/show/', $related).'.atom');
 
                        if ($related_atom['success']) {
                                logger('GNU Social workaround to fetch XML for URI '.$related_uri, LOGGER_DEBUG);
@@ -968,7 +969,7 @@ class OStatus
                // Even more worse workaround for GNU Social ;-)
                if ($xml == '') {
                        $related_guess = OStatus::convertHref($related_uri);
-                       $related_atom = z_fetch_url(str_replace('/notice/', '/api/statuses/show/', $related_guess).'.atom');
+                       $related_atom = Network::zFetchURL(str_replace('/notice/', '/api/statuses/show/', $related_guess).'.atom');
 
                        if ($related_atom['success']) {
                                logger('GNU Social workaround 2 to fetch XML for URI '.$related_uri, LOGGER_DEBUG);
index 65e71d07a9ca4536ad68a3431e6b7b0fe6346413..35ec7fe9624b7fa29629eff0008d02bcb81b00c7 100644 (file)
@@ -288,7 +288,7 @@ class PortableContact
                }
 
                // Fetch the host-meta to check if this really is a server
-               $serverret = z_fetch_url($server_url."/.well-known/host-meta");
+               $serverret = Network::zFetchURL($server_url."/.well-known/host-meta");
                if (!$serverret["success"]) {
                        return "";
                }
@@ -367,7 +367,7 @@ class PortableContact
                        $server = q("SELECT `noscrape`, `network` FROM `gserver` WHERE `nurl` = '%s' AND `noscrape` != ''", dbesc(normalise_link($server_url)));
 
                        if ($server) {
-                               $noscraperet = z_fetch_url($server[0]["noscrape"]."/".$gcontacts[0]["nick"]);
+                               $noscraperet = Network::zFetchURL($server[0]["noscrape"]."/".$gcontacts[0]["nick"]);
 
                                if ($noscraperet["success"] && ($noscraperet["body"] != "")) {
                                        $noscrape = json_decode($noscraperet["body"], true);
@@ -481,7 +481,7 @@ class PortableContact
 
                GContact::update($contact);
 
-               $feedret = z_fetch_url($data["poll"]);
+               $feedret = Network::zFetchURL($data["poll"]);
 
                if (!$feedret["success"]) {
                        $fields = ['last_failure' => datetime_convert()];
@@ -632,7 +632,7 @@ class PortableContact
         */
        private static function fetchNodeinfo($server_url)
        {
-               $serverret = z_fetch_url($server_url."/.well-known/nodeinfo");
+               $serverret = Network::zFetchURL($server_url."/.well-known/nodeinfo");
                if (!$serverret["success"]) {
                        return false;
                }
@@ -664,7 +664,7 @@ class PortableContact
                        return false;
                }
 
-               $serverret = z_fetch_url($nodeinfo_url);
+               $serverret = Network::zFetchURL($nodeinfo_url);
                if (!$serverret["success"]) {
                        return false;
                }
@@ -873,7 +873,7 @@ class PortableContact
                $server_url = str_replace("http://", "https://", $server_url);
 
                // We set the timeout to 20 seconds since this operation should be done in no time if the server was vital
-               $serverret = z_fetch_url($server_url."/.well-known/host-meta", false, $redirects, ['timeout' => 20]);
+               $serverret = Network::zFetchURL($server_url."/.well-known/host-meta", false, $redirects, ['timeout' => 20]);
 
                // Quit if there is a timeout.
                // But we want to make sure to only quit if we are mostly sure that this server url fits.
@@ -890,7 +890,7 @@ class PortableContact
                        $server_url = str_replace("https://", "http://", $server_url);
 
                        // We set the timeout to 20 seconds since this operation should be done in no time if the server was vital
-                       $serverret = z_fetch_url($server_url."/.well-known/host-meta", false, $redirects, ['timeout' => 20]);
+                       $serverret = Network::zFetchURL($server_url."/.well-known/host-meta", false, $redirects, ['timeout' => 20]);
 
                        // Quit if there is a timeout
                        if ($serverret['errno'] == CURLE_OPERATION_TIMEDOUT) {
@@ -926,7 +926,7 @@ class PortableContact
 
                // Look for poco
                if (!$failure) {
-                       $serverret = z_fetch_url($server_url."/poco");
+                       $serverret = Network::zFetchURL($server_url."/poco");
                        if ($serverret["success"]) {
                                $data = json_decode($serverret["body"]);
                                if (isset($data->totalResults)) {
@@ -952,7 +952,7 @@ class PortableContact
 
                if (!$failure) {
                        // Test for Diaspora, Hubzilla, Mastodon or older Friendica servers
-                       $serverret = z_fetch_url($server_url);
+                       $serverret = Network::zFetchURL($server_url);
 
                        if (!$serverret["success"] || ($serverret["body"] == "")) {
                                $failure = true;
@@ -991,7 +991,7 @@ class PortableContact
                        // Test for Statusnet
                        // Will also return data for Friendica and GNU Social - but it will be overwritten later
                        // The "not implemented" is a special treatment for really, really old Friendica versions
-                       $serverret = z_fetch_url($server_url."/api/statusnet/version.json");
+                       $serverret = Network::zFetchURL($server_url."/api/statusnet/version.json");
                        if ($serverret["success"] && ($serverret["body"] != '{"error":"not implemented"}') &&
                                ($serverret["body"] != '') && (strlen($serverret["body"]) < 30)) {
                                $platform = "StatusNet";
@@ -1002,7 +1002,7 @@ class PortableContact
                        }
 
                        // Test for GNU Social
-                       $serverret = z_fetch_url($server_url."/api/gnusocial/version.json");
+                       $serverret = Network::zFetchURL($server_url."/api/gnusocial/version.json");
                        if ($serverret["success"] && ($serverret["body"] != '{"error":"not implemented"}') &&
                                ($serverret["body"] != '') && (strlen($serverret["body"]) < 30)) {
                                $platform = "GNU Social";
@@ -1014,7 +1014,7 @@ class PortableContact
 
                        // Test for Mastodon
                        $orig_version = $version;
-                       $serverret = z_fetch_url($server_url."/api/v1/instance");
+                       $serverret = Network::zFetchURL($server_url."/api/v1/instance");
                        if ($serverret["success"] && ($serverret["body"] != '')) {
                                $data = json_decode($serverret["body"]);
 
@@ -1037,7 +1037,7 @@ class PortableContact
 
                if (!$failure) {
                        // Test for Hubzilla and Red
-                       $serverret = z_fetch_url($server_url."/siteinfo.json");
+                       $serverret = Network::zFetchURL($server_url."/siteinfo.json");
                        if ($serverret["success"]) {
                                $data = json_decode($serverret["body"]);
                                if (isset($data->url)) {
@@ -1065,7 +1065,7 @@ class PortableContact
                                }
                        } else {
                                // Test for Hubzilla, Redmatrix or Friendica
-                               $serverret = z_fetch_url($server_url."/api/statusnet/config.json");
+                               $serverret = Network::zFetchURL($server_url."/api/statusnet/config.json");
                                if ($serverret["success"]) {
                                        $data = json_decode($serverret["body"]);
                                        if (isset($data->site->server)) {
@@ -1120,7 +1120,7 @@ class PortableContact
 
                // Query statistics.json. Optional package for Diaspora, Friendica and Redmatrix
                if (!$failure) {
-                       $serverret = z_fetch_url($server_url."/statistics.json");
+                       $serverret = Network::zFetchURL($server_url."/statistics.json");
                        if ($serverret["success"]) {
                                $data = json_decode($serverret["body"]);
 
@@ -1182,10 +1182,10 @@ class PortableContact
                // Check for noscrape
                // Friendica servers could be detected as OStatus servers
                if (!$failure && in_array($network, [NETWORK_DFRN, NETWORK_OSTATUS])) {
-                       $serverret = z_fetch_url($server_url."/friendica/json");
+                       $serverret = Network::zFetchURL($server_url."/friendica/json");
 
                        if (!$serverret["success"]) {
-                               $serverret = z_fetch_url($server_url."/friendika/json");
+                               $serverret = Network::zFetchURL($server_url."/friendika/json");
                        }
 
                        if ($serverret["success"]) {
@@ -1295,7 +1295,7 @@ class PortableContact
         */
        private static function fetchServerlist($poco)
        {
-               $serverret = z_fetch_url($poco."/@server");
+               $serverret = Network::zFetchURL($poco."/@server");
                if (!$serverret["success"]) {
                        return;
                }
@@ -1344,7 +1344,7 @@ class PortableContact
                        if (!empty($accesstoken)) {
                                $api = 'https://instances.social/api/1.0/instances/list?count=0';
                                $header = ['Authorization: Bearer '.$accesstoken];
-                               $serverdata = z_fetch_url($api, false, $redirects, ['headers' => $header]);
+                               $serverdata = Network::zFetchURL($api, false, $redirects, ['headers' => $header]);
                                if ($serverdata['success']) {
                                        $servers = json_decode($serverdata['body']);
                                        foreach ($servers->instances as $server) {
@@ -1361,7 +1361,7 @@ class PortableContact
                //if (!Config::get('system','ostatus_disabled')) {
                //      $serverdata = "http://gstools.org/api/get_open_instances/";
 
-               //      $result = z_fetch_url($serverdata);
+               //      $result = Network::zFetchURL($serverdata);
                //      if ($result["success"]) {
                //              $servers = json_decode($result["body"]);
 
@@ -1390,7 +1390,7 @@ class PortableContact
 
                logger("Fetch all users from the server ".$server["url"], LOGGER_DEBUG);
 
-               $retdata = z_fetch_url($url);
+               $retdata = Network::zFetchURL($url);
                if ($retdata["success"]) {
                        $data = json_decode($retdata["body"]);
 
@@ -1409,7 +1409,7 @@ class PortableContact
 
                                $success = false;
 
-                               $retdata = z_fetch_url($url);
+                               $retdata = Network::zFetchURL($url);
                                if ($retdata["success"]) {
                                        logger("Fetch all global contacts from the server ".$server["nurl"], LOGGER_DEBUG);
                                        $success = self::discoverServer(json_decode($retdata["body"]));
@@ -1494,7 +1494,7 @@ class PortableContact
                                // Fetch all contacts from a given user from the other server
                                $url = $server["poco"]."/".$username."/?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation";
 
-                               $retdata = z_fetch_url($url);
+                               $retdata = Network::zFetchURL($url);
                                if ($retdata["success"]) {
                                        self::discoverServer(json_decode($retdata["body"]), 3);
                                }
index 8940c02055880ca54d04cccc4477432b0cf16e2e..35e812a5c9ade6ee11c0f1225c7fdbe8b0d95095 100644 (file)
@@ -38,9 +38,9 @@ use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Database\DBM;
 use Friendica\Model\User;
+use Friendica\Util\Network;
 use dba;
 
-require_once 'include/dba.php';
 require_once 'include/dba.php';
 
 class ExAuth
@@ -181,7 +181,7 @@ class ExAuth
 
                $url = ($ssl ? 'https' : 'http') . '://' . $host . '/noscrape/' . $user;
 
-               $data = z_fetch_url($url);
+               $data = Network::zFetchURL($url);
 
                if (!is_array($data)) {
                        return false;
index 39f2e03511f939518922230dcadc823460c1f1ea..ebe6abda4748195fd5bcb3b97d28c35472ad797b 100644 (file)
@@ -233,7 +233,7 @@ class Network
                        if (filter_var($newurl, FILTER_VALIDATE_URL)) {
                                $redirects++;
                                @curl_close($ch);
-                               return z_fetch_url($newurl, $binary, $redirects, $opts);
+                               return self::zFetchURL($newurl, $binary, $redirects, $opts);
                        }
                }
 
index b03fcd9827b8e6b2517beafeddab6b479513f9eb..67aebb4c72120fdef0a8876f91fa3eb369ada31f 100644 (file)
@@ -8,6 +8,7 @@ namespace Friendica\Util;
 use Friendica\Content\OEmbed;
 use Friendica\Core\Addon;
 use Friendica\Object\Image;
+use Friendica\Util\Network;
 use Friendica\Util\XML;
 
 use dba;
@@ -145,7 +146,7 @@ class ParseUrl
                $siteinfo["url"] = $url;
                $siteinfo["type"] = "link";
 
-               $data = z_fetch_url($url);
+               $data = Network::zFetchURL($url);
                if (!$data['success']) {
                        return($siteinfo);
                }
index d72579cfb50524239831dc33701c014e963fa4f7..0172bcd34234f5bf88600e291f681f3af03a038f 100644 (file)
@@ -281,7 +281,7 @@ class DiscoverPoCo {
 
                $url = "http://gstools.org/api/users_search/".urlencode($search);
 
-               $result = z_fetch_url($url);
+               $result = Network::zFetchURL($url);
                if (!$result["success"]) {
                        return false;
                }
index 293cd265e26038be91332ee0896694f3580ce1fc..98b5f778698736a2b000f99f77cfa132b28e18ee 100644 (file)
@@ -10,6 +10,7 @@ use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Protocol\Email;
 use Friendica\Protocol\PortableContact;
+use Friendica\Util\Network;
 use dba;
 
 require_once 'include/dba.php';
@@ -176,7 +177,7 @@ class OnePoll
                                . '&type=data&last_update=' . $last_update
                                . '&perm=' . $perm ;
 
-                       $ret = z_fetch_url($url);
+                       $ret = Network::zFetchURL($url);
 
                        if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
                                // set the last-update so we don't keep polling
@@ -311,7 +312,7 @@ class OnePoll
                        }
 
                        $cookiejar = tempnam(get_temppath(), 'cookiejar-onepoll-');
-                       $ret = z_fetch_url($contact['poll'], false, $redirects, ['cookiejar' => $cookiejar]);
+                       $ret = Network::zFetchURL($contact['poll'], false, $redirects, ['cookiejar' => $cookiejar]);
                        unlink($cookiejar);
 
                        if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {