mirror of
https://github.com/friendica/friendica
synced 2024-11-10 05:02:58 +00:00
Move z_fetch_url
move z_fetch_url method
This commit is contained in:
parent
c67452f72e
commit
2f9642392d
14 changed files with 58 additions and 60 deletions
|
@ -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'])) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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.");
|
||||
|
|
|
@ -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 = [];
|
||||
|
|
|
@ -981,7 +981,7 @@ class GContact
|
|||
|
||||
$url = $server."/main/statistics";
|
||||
|
||||
$result = z_fetch_url($url);
|
||||
$result = Network::zFetchURL($url);
|
||||
if (!$result["success"]) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue