use Friendica\Network\HTTPException\TooManyRequestsException;
use Friendica\Object\Image;
use Friendica\Protocol\Diaspora;
+use Friendica\Util\Network;
use Friendica\Util\XML;
require_once 'include/bbcode.php';
if ($StatusnetHost != $profile) {
$StatusnetUser = preg_replace("=https?://(.*)/user/(.*)=ism", "$2", $profile);
if ($StatusnetUser != $profile) {
- $UserData = fetch_url("http://".$StatusnetHost."/api/users/show.json?user_id=".$StatusnetUser);
+ $UserData = Network::fetchURL("http://".$StatusnetHost."/api/users/show.json?user_id=".$StatusnetUser);
$user = json_decode($UserData);
if ($user) {
$nick = $user->screen_name;
use Friendica\Core\Config;
use Friendica\Model\Contact;
use Friendica\Util\Map;
+use Friendica\Util\Network;
require_once 'include/event.php';
require_once 'mod/proxy.php';
$StatusnetUser = preg_replace("=https?://(.*)/user/(.*)=ism", "$2", $profile);
if ($StatusnetUser != $profile) {
/// @TODO Some hosts run on https, not just http and sometimes http is disabled, let's support both here
- $UserData = fetch_url("http://".$StatusnetHost."/api/users/show.json?user_id=".$StatusnetUser);
+ $UserData = Network::fetchURL("http://".$StatusnetHost."/api/users/show.json?user_id=".$StatusnetUser);
$user = json_decode($UserData);
if ($user) {
if ($getnetwork) {
// if its not a picture then look if its a page that contains a picture link
require_once("include/network.php");
- $body = fetch_url($match[1]);
+ $body = Network::fetchURL($match[1]);
$doc = new DOMDocument();
@$doc->loadHTML($body);
// if its not a picture then look if its a page that contains a picture link
require_once("include/network.php");
- $body = fetch_url($match[1]);
+ $body = Network::fetchURL($match[1]);
$doc = new DOMDocument();
@$doc->loadHTML($body);
return Network::blockedURL($url);
}
-function allowedEmail($email)
+function allowed_email($email)
{
return Network::allowedEmail($email);
}
use Friendica\Module\Login;
use Friendica\Protocol\DFRN;
use Friendica\Protocol\OStatus;
+use Friendica\Util\Network;
require_once 'include/items.php';
);
if (DBM::is_result($r)) {
- $s = fetch_url($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check');
+ $s = Network::fetchURL($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check');
logger("dfrn_poll: old profile returns " . $s, LOGGER_DATA);
if (($type === 'profile') && (strlen($sec))) {
// URL reply
if ($dfrn_version < 2.2) {
- $s = fetch_url($r[0]['poll']
+ $s = Network::fetchURL($r[0]['poll']
. '?dfrn_id=' . $encrypted_id
. '&type=profile-check'
. '&dfrn_version=' . DFRN_PROTOCOL_VERSION
use Friendica\Model\Profile;
use Friendica\Module\Login;
use Friendica\Network\Probe;
+use Friendica\Util\Network;
require_once 'include/enotify.php';
}
if (strlen($dfrn_request) && strlen($confirm_key)) {
- $s = fetch_url($dfrn_request . '?confirm_key=' . $confirm_key);
+ $s = Network::fetchURL($dfrn_request . '?confirm_key=' . $confirm_key);
}
// (ignore reply, nothing we can do it failed)
use Friendica\Model\Profile;
use Friendica\Network\Probe;
use Friendica\Protocol\PortableContact;
+use Friendica\Util\Network;
require_once 'mod/contacts.php';
$p = (($a->pager['page'] != 1) ? '&p=' . $a->pager['page'] : '');
if(strlen(Config::get('system','directory')))
- $x = fetch_url(get_server().'/lsearch?f=' . $p . '&search=' . urlencode($search));
+ $x = Network::fetchURL(get_server().'/lsearch?f=' . $p . '&search=' . urlencode($search));
$j = json_decode($x);
}
use Friendica\Database\DBM;
use Friendica\Database\DBStructure;
use Friendica\Object\Image;
+use Friendica\Util\Network;
$install_wizard_pass = 1;
$status = true;
$help = "";
if (function_exists('curl_init')) {
- $test = fetch_url(System::baseUrl()."/install/testrewrite");
+ $test = Network::fetchURL(System::baseUrl()."/install/testrewrite");
if ($test != "ok") {
- $test = fetch_url(normalise_link(System::baseUrl()."/install/testrewrite"));
+ $test = Network::fetchURL(normalise_link(System::baseUrl()."/install/testrewrite"));
}
if ($test != "ok") {
use Friendica\Core\Addon;
use Friendica\Core\System;
use Friendica\Core\Config;
+use Friendica\Util\Network;
function nodeinfo_wellknown(App $a) {
$nodeinfo = ['links' => [['rel' => 'http://nodeinfo.diaspora.software/ns/schema/1.0',
// Now trying to register
$url = 'http://the-federation.info/register/'.$a->get_hostname();
logger('registering url: '.$url, LOGGER_DEBUG);
- $ret = fetch_url($url);
+ $ret = Network::fetchURL($url);
logger('registering answer: '.$ret, LOGGER_DEBUG);
logger('cron_end');
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Module\Login;
+use Friendica\Util\Network;
function oexchange_init(App $a) {
$tags = (((x($_REQUEST,'tags')) && strlen($_REQUEST['tags']))
? '&tags=' . urlencode(notags(trim($_REQUEST['tags']))) : '');
- $s = fetch_url(System::baseUrl() . '/parse_url?f=&url=' . $url . $title . $description . $tags);
+ $s = Network::fetchURL(System::baseUrl() . '/parse_url?f=&url=' . $url . $title . $description . $tags);
if (! strlen($s)) {
return;
use Friendica\Database\DBM;
use Friendica\Model\Photo;
use Friendica\Object\Image;
+use Friendica\Util\Network;
define('PROXY_DEFAULT_TIME', 86400); // 1 Day
// It shouldn't happen but it does - spaces in URL
$_REQUEST['url'] = str_replace(' ', '+', $_REQUEST['url']);
$redirects = 0;
- $img_str = fetch_url($_REQUEST['url'], true, $redirects, 10);
+ $img_str = Network::fetchURL($_REQUEST['url'], true, $redirects, 10);
$tempfile = tempnam(get_temppath(), 'cache');
file_put_contents($tempfile, $img_str);
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Database\DBM;
+use Friendica\Util\Network;
function post_var($name) {
return (x($_POST, $name)) ? notags(trim($_POST[$name])) : '';
// we don't actually enforce the lease time because GNU
// Social/StatusNet doesn't honour it (yet)
- $body = fetch_url($hub_callback . "?" . $params);
+ $body = Network::fetchURL($hub_callback . "?" . $params);
$ret = $a->get_curl_code();
// give up if the HTTP return code wasn't a success (2xx)
<text x="149" y="2112" style="font:13px Open Sans">- create a contact for Karen in the contact table with </text>
<text x="149" y="2135" style="font:13px Open Sans">the scraped data with blocked = 1 and pending = 1 </text>
<text x="149" y="2158" style="font:13px Open Sans">(Karens pubkey becomes the contact site-pubkey)</text>
-<text x="149" y="2204" style="font:13px Open Sans">- fetch_url($dfrn_request . '?confirm_key=' . </text>
+<text x="149" y="2204" style="font:13px Open Sans">- Network::fetchURL($dfrn_request . '?confirm_key=' . </text>
<text x="149" y="2227" style="font:13px Open Sans">$confirm_key);</text>
-<text x="149" y="2273" style="font:13px Open Sans">- fetch_url(http://karenhomepage.com/dfrn_request?</text>
+<text x="149" y="2273" style="font:13px Open Sans">- Network::fetchURL(http://karenhomepage.com/dfrn_request?</text>
<text x="149" y="2296" style="font:13px Open Sans">confirm_key=”ABC123”)</text>
<clipPath id="clip13"><path d="M1061,2027 L1238,2027 L1238,2069 L1061,2069 L1061,2027 Z" /></clipPath>
<path d="M1070,2028 C1065.5820313,2028 1062,2031.5820313 1062,2036 L1062,2059 C1062,2063.4179688 1065.5820313,2067 1070,2067 L1228,2067 C1232.4179688,2067 1236,2063.4179688 1236,2059 L1236,2036 C1236,2031.5820313 1232.4179688,2028 1228,2028 Z" style="fill:rgb(127,127,127);stroke:none" clip-path="url(#clip13)" />
use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Database\DBM;
+use Friendica\Util\Network;
use Friendica\Util\ParseUrl;
use dba;
use DOMDocument;
if (!in_array($ext, $noexts)) {
// try oembed autodiscovery
$redirects = 0;
- $html_text = fetch_url($embedurl, false, $redirects, 15, "text/*");
+ $html_text = Network::fetchURL($embedurl, false, $redirects, 15, "text/*");
if ($html_text) {
$dom = @DOMDocument::loadHTML($html_text);
if ($dom) {
$entries = $xpath->query("//link[@type='application/json+oembed']");
foreach ($entries as $e) {
$href = $e->getAttributeNode("href")->nodeValue;
- $txt = fetch_url($href . '&maxwidth=' . $a->videowidth);
+ $txt = Network::fetchURL($href . '&maxwidth=' . $a->videowidth);
break;
}
$entries = $xpath->query("//link[@type='text/json+oembed']");
foreach ($entries as $e) {
$href = $e->getAttributeNode("href")->nodeValue;
- $txt = fetch_url($href . '&maxwidth=' . $a->videowidth);
+ $txt = Network::fetchURL($href . '&maxwidth=' . $a->videowidth);
break;
}
}
use Friendica\Database\DBM;
use Friendica\Model\Process;
use Friendica\Util\Lock;
-
+use Friendica\Util\Network;
use dba;
require_once 'include/dba.php';
}
$url = System::baseUrl()."/worker";
- fetch_url($url, false, $redirects, 1);
+ Network::fetchURL($url, false, $redirects, 1);
}
/**
use Friendica\Model\Profile;
use Friendica\Network\Probe;
use Friendica\Protocol\PortableContact;
+use Friendica\Util\Network;
use dba;
use Exception;
$done[] = System::baseUrl() . '/poco';
if (strlen(Config::get('system', 'directory'))) {
- $x = fetch_url(get_server()."/pubsites");
+ $x = Network::fetchURL(get_server()."/pubsites");
if ($x) {
$j = json_decode($x);
if ($j->entries) {
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Object\Image;
+use Friendica\Util\Network;
use dba;
require_once 'include/dba.php';
$photo_failure = false;
$filename = basename($image_url);
- $img_str = fetch_url($image_url, true);
+ $img_str = Network::fetchURL($image_url, true);
if ($quit_on_error && ($img_str == "")) {
return false;
use Friendica\Model\Photo;
use Friendica\Object\Image;
use Friendica\Util\Crypto;
+use Friendica\Util\Network;
use dba;
use Exception;
$photo_failure = false;
$filename = basename($photo);
- $img_str = fetch_url($photo, true);
+ $img_str = Network::fetchURL($photo, true);
// guess mimetype from headers or filename
$type = Image::guessType($photo, true);
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Photo;
+use Friendica\Util\Network;
use Exception;
use Imagick;
use ImagickPixel;
$data = Cache::get($url);
if (is_null($data) || !$data || !is_array($data)) {
- $img_str = fetch_url($url, true, $redirects, 4);
+ $img_str = Network::fetchURL($url, true, $redirects, 4);
$filesize = strlen($img_str);
if (function_exists("getimagesizefromstring")) {
use Friendica\Model\User;
use Friendica\Network\Probe;
use Friendica\Util\Crypto;
+use Friendica\Util\Network;
use Friendica\Util\XML;
-
use dba;
use SimpleXMLElement;
logger("Fetch post from ".$source_url, LOGGER_DEBUG);
- $envelope = fetch_url($source_url);
+ $envelope = Network::fetchURL($source_url);
if ($envelope) {
logger("Envelope was fetched.", LOGGER_DEBUG);
$x = self::verifyMagicEnvelope($envelope);
$source_url = $server."/p/".urlencode($guid).".xml";
logger("Fetch post from ".$source_url, LOGGER_DEBUG);
- $x = fetch_url($source_url);
+ $x = Network::fetchURL($source_url);
if (!$x) {
return false;
}
use Friendica\Model\GContact;
use Friendica\Model\Profile;
use Friendica\Network\Probe;
+use Friendica\Util\Network;
use dba;
use DOMDocument;
use DOMXPath;
logger('load: ' . $url, LOGGER_DEBUG);
- $s = fetch_url($url);
+ $s = Network::fetchURL($url);
logger('load: returns ' . $s, LOGGER_DATA);
use Friendica\Network\Probe;
use Friendica\Util\Crypto;
+use Friendica\Util\Network;
use Friendica\Util\XML;
/**
$ret[$x] = substr($ret[$x], 5);
}
} elseif (normalise_link($ret[$x]) == 'http://') {
- $ret[$x] = fetch_url($ret[$x]);
+ $ret[$x] = Network::fetchURL($ret[$x]);
}
}
}
} else {
$scaled = $mtch[1];
}
- $i = fetch_url($scaled);
+ $i = self::fetchURL($scaled);
if (! $i) {
return $srctext;
}
namespace Friendica\Worker;
use Friendica\Core\Config;
+use Friendica\Util\Network;
/**
* @brief check the git repository VERSION file and save the version to the DB
logger("Checking VERSION from: ".$checked_url, LOGGER_DEBUG);
// fetch the VERSION file
- $gitversion = dbesc(trim(fetch_url($checked_url)));
+ $gitversion = dbesc(trim(Network::fetchURL($checked_url)));
logger("Upstream VERSION is: ".$gitversion, LOGGER_DEBUG);
Config::set('system', 'git_friendica_version', $gitversion);
use Friendica\Core\Config;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
+use Friendica\Util\Network;
class Directory {
public static function execute($url = '') {
logger('Updating directory: ' . $arr['url'], LOGGER_DEBUG);
if (strlen($arr['url'])) {
- fetch_url($dir . '?url=' . bin2hex($arr['url']));
+ Network::fetchURL($dir . '?url=' . bin2hex($arr['url']));
}
return;
use Friendica\Model\GContact;
use Friendica\Network\Probe;
use Friendica\Protocol\PortableContact;
+use Friendica\Util\Network;
require_once 'include/datetime.php';
}
}
- $x = fetch_url(get_server()."/lsearch?p=1&n=500&search=".urlencode($search));
+ $x = Network::fetchURL(get_server()."/lsearch?p=1&n=500&search=".urlencode($search));
$j = json_decode($x);
if (count($j->results)) {