use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
-use Friendica\Network\HTTPRequest;
use Friendica\Protocol\DFRN;
use Friendica\Protocol\OStatus;
use Friendica\Util\Strings;
);
if (DBA::isResult($r)) {
- $s = HTTPRequest::fetchUrl($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check');
+ $s = DI::httpRequest()->fetchUrl($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check');
Logger::log("dfrn_poll: old profile returns " . $s, Logger::DATA);
// URL reply
if ($dfrn_version < 2.2) {
- $s = HTTPRequest::fetchUrl($r[0]['poll']
+ $s = DI::httpRequest()->fetchUrl($r[0]['poll']
. '?dfrn_id=' . $encrypted_id
. '&type=profile-check'
. '&dfrn_version=' . DFRN_PROTOCOL_VERSION
use Friendica\Model\Profile;
use Friendica\Model\User;
use Friendica\Module\Security\Login;
-use Friendica\Network\HTTPRequest;
use Friendica\Network\Probe;
use Friendica\Protocol\Activity;
use Friendica\Util\DateTimeFormat;
}
if (!empty($dfrn_request) && strlen($confirm_key)) {
- HTTPRequest::fetchUrl($dfrn_request . '?confirm_key=' . $confirm_key);
+ DI::httpRequest()->fetchUrl($dfrn_request . '?confirm_key=' . $confirm_key);
}
// (ignore reply, nothing we can do it failed)
use Friendica\Core\Renderer;
use Friendica\DI;
use Friendica\Module\Security\Login;
-use Friendica\Network\HTTPRequest;
use Friendica\Util\Strings;
function oexchange_init(App $a) {
$tags = ((!empty($_REQUEST['tags']))
? '&tags=' . urlencode(Strings::escapeTags(trim($_REQUEST['tags']))) : '');
- $s = HTTPRequest::fetchUrl(DI::baseUrl() . '/parse_url?url=' . $url . $title . $description . $tags);
+ $s = DI::httpRequest()->fetchUrl(DI::baseUrl() . '/parse_url?url=' . $url . $title . $description . $tags);
if (!strlen($s)) {
return;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\DI;
-use Friendica\Network\HTTPRequest;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
use Friendica\Util\ParseUrl;
if (!in_array($ext, $noexts)) {
// try oembed autodiscovery
- $html_text = HTTPRequest::fetchUrl($embedurl, false, 15, 'text/*');
+ $html_text = DI::httpRequest()->fetchUrl($embedurl, false, 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;
- $json_string = HTTPRequest::fetchUrl($href . '&maxwidth=' . $a->videowidth);
+ $json_string = DI::httpRequest()->fetchUrl($href . '&maxwidth=' . $a->videowidth);
break;
}
$entries = $xpath->query("//link[@type='text/json+oembed']");
foreach ($entries as $e) {
$href = $e->getAttributeNode('href')->nodeValue;
- $json_string = HTTPRequest::fetchUrl($href . '&maxwidth=' . $a->videowidth);
+ $json_string = DI::httpRequest()->fetchUrl($href . '&maxwidth=' . $a->videowidth);
break;
}
}
use Friendica\Model\Event;
use Friendica\Model\Photo;
use Friendica\Model\Tag;
-use Friendica\Network\HTTPRequest;
use Friendica\Object\Image;
use Friendica\Protocol\Activity;
use Friendica\Util\Images;
continue;
}
- $curlResult = HTTPRequest::curl($mtch[1], true);
+ $curlResult = DI::httpRequest()->curl($mtch[1], true);
if (!$curlResult->isSuccess()) {
continue;
}
$text = "[url=" . $match[2] . ']' . $match[2] . "[/url]";
// if its not a picture then look if its a page that contains a picture link
- $body = HTTPRequest::fetchUrl($match[1]);
+ $body = DI::httpRequest()->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
- $body = HTTPRequest::fetchUrl($match[1]);
+ $body = DI::httpRequest()->fetchUrl($match[1]);
$doc = new DOMDocument();
@$doc->loadHTML($body);
namespace Friendica\Core;
-use Friendica\Network\HTTPRequest;
-
/**
* Manage compatibility with federated networks
*/
if (preg_match('=https?://(.*)/user/(.*)=ism', $profile_url, $matches)) {
$statusnet_host = $matches[1];
$statusnet_user = $matches[2];
- $UserData = HTTPRequest::fetchUrl('http://' . $statusnet_host . '/api/users/show.json?user_id=' . $statusnet_user);
+ $UserData = DI::httpRequest()->fetchUrl('http://' . $statusnet_host . '/api/users/show.json?user_id=' . $statusnet_user);
$user = json_decode($UserData);
if ($user) {
$matches[2] = $user->screen_name;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
use Friendica\Network\HTTPException;
-use Friendica\Network\HTTPRequest;
use Friendica\Object\Search\ContactResult;
use Friendica\Object\Search\ResultList;
use Friendica\Util\Network;
$searchUrl .= '&page=' . $page;
}
- $resultJson = HTTPRequest::fetchUrl($searchUrl, false, 0, 'application/json');
+ $resultJson = DI::httpRequest()->fetchUrl($searchUrl, false, 0, 'application/json');
$results = json_decode($resultJson, true);
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Process;
-use Friendica\Network\HTTPRequest;
use Friendica\Util\DateTimeFormat;
/**
}
$url = DI::baseUrl() . '/worker';
- HTTPRequest::fetchUrl($url, false, 1);
+ DI::httpRequest()->fetchUrl($url, false, 1);
}
/**
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\DI;
-use Friendica\Network\HTTPRequest;
use Friendica\Network\Probe;
use Friendica\Protocol\ActivityPub;
use Friendica\Protocol\PortableContact;
$done[] = DI::baseUrl() . '/poco';
if (strlen(DI::config()->get('system', 'directory'))) {
- $x = HTTPRequest::fetchUrl(Search::getGlobalDirectory() . '/pubsites');
+ $x = DI::httpRequest()->fetchUrl(Search::getGlobalDirectory() . '/pubsites');
if (!empty($x)) {
$j = json_decode($x);
if (!empty($j->entries)) {
use Friendica\DI;
use Friendica\Module\Register;
use Friendica\Network\CurlResult;
-use Friendica\Network\HTTPRequest;
use Friendica\Protocol\Diaspora;
use Friendica\Protocol\PortableContact;
use Friendica\Util\DateTimeFormat;
$protocols = ['activitypub', 'diaspora', 'dfrn', 'ostatus'];
foreach ($protocols as $protocol) {
$query = '{nodes(protocol:"' . $protocol . '"){host}}';
- $curlResult = HTTPRequest::fetchUrl('https://the-federation.info/graphql?query=' . urlencode($query));
+ $curlResult = DI::httpRequest()->fetchUrl('https://the-federation.info/graphql?query=' . urlencode($query));
if (!empty($curlResult)) {
$data = json_decode($curlResult, true);
if (!empty($data['data']['nodes'])) {
use Friendica\DI;
use Friendica\Model\TwoFactor\AppSpecificPassword;
use Friendica\Network\HTTPException\InternalServerErrorException;
-use Friendica\Network\HTTPRequest;
use Friendica\Object\Image;
use Friendica\Util\Crypto;
use Friendica\Util\DateTimeFormat;
$photo_failure = false;
$filename = basename($photo);
- $curlResult = HTTPRequest::curl($photo, true);
+ $curlResult = DI::httpRequest()->curl($photo, true);
if ($curlResult->isSuccess()) {
$img_str = $curlResult->getBody();
$type = $curlResult->getContentType();
use Friendica\Core\Renderer;
use Friendica\DI;
use Friendica\Model;
-use Friendica\Network\HTTPRequest;
use Friendica\Protocol;
/**
$contact = Model\Contact::getByURLForUser($url, local_user(), false);
- $xml = HTTPRequest::fetchUrl($contact['poll']);
+ $xml = DI::httpRequest()->fetchUrl($contact['poll']);
$import_result = Protocol\Feed::import($xml);
* @return string The fetched content
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function fetchUrl(string $url, bool $binary = false, int $timeout = 0, string $accept_content = '', string $cookiejar = '', int &$redirects = 0)
+ public function fetchUrl(string $url, bool $binary = false, int $timeout = 0, string $accept_content = '', string $cookiejar = '', int &$redirects = 0)
{
- $ret = self::fetchUrlFull($url, $binary, $timeout, $accept_content, $cookiejar, $redirects);
+ $ret = $this->fetchUrlFull($url, $binary, $timeout, $accept_content, $cookiejar, $redirects);
return $ret->getBody();
}
use Friendica\Model\Post;
use Friendica\Model\Tag;
use Friendica\Model\User;
-use Friendica\Network\HTTPRequest;
use Friendica\Network\Probe;
use Friendica\Util\Crypto;
use Friendica\Util\DateTimeFormat;
Logger::log("Fetch post from ".$source_url, Logger::DEBUG);
- $envelope = HTTPRequest::fetchUrl($source_url);
+ $envelope = DI::httpRequest()->fetchUrl($source_url);
if ($envelope) {
Logger::log("Envelope was fetched.", Logger::DEBUG);
$x = self::verifyMagicEnvelope($envelope);
namespace Friendica\Protocol;
use Friendica\Core\Logger;
-use Friendica\Network\HTTPRequest;
use Friendica\Network\Probe;
use Friendica\Util\Crypto;
use Friendica\Util\Strings;
$ret[$x] = substr($ret[$x], 5);
}
} elseif (Strings::normaliseLink($ret[$x]) == 'http://') {
- $ret[$x] = HTTPRequest::fetchUrl($ret[$x]);
+ $ret[$x] = DI::httpRequest()->fetchUrl($ret[$x]);
}
}
}
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\DI;
-use Friendica\Network\HTTPRequest;
/**
* Image utilities
return $data;
}
- $img_str = HTTPRequest::fetchUrl($url, true, 4);
+ $img_str = DI::httpRequest()->fetchUrl($url, true, 4);
if (!$img_str) {
return [];
use Friendica\Core\Logger;
use Friendica\Database\DBA;
use Friendica\DI;
-use Friendica\Network\HTTPRequest;
/**
* Check the git repository VERSION file and save the version to the DB
Logger::log("Checking VERSION from: ".$checked_url, Logger::DEBUG);
// fetch the VERSION file
- $gitversion = DBA::escape(trim(HTTPRequest::fetchUrl($checked_url)));
+ $gitversion = DBA::escape(trim(DI::httpRequest()->fetchUrl($checked_url)));
Logger::log("Upstream VERSION is: ".$gitversion, Logger::DEBUG);
DI::config()->set('system', 'git_friendica_version', $gitversion);
use Friendica\Model\Nodeinfo;
use Friendica\Model\Photo;
use Friendica\Model\User;
-use Friendica\Network\HTTPRequest;
use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Util\Strings;
// Now trying to register
$url = 'http://the-federation.info/register/' . DI::baseUrl()->getHostname();
Logger::debug('Check registering url', ['url' => $url]);
- $ret = HTTPRequest::fetchUrl($url);
+ $ret = DI::httpRequest()->fetchUrl($url);
Logger::debug('Check registering answer', ['answer' => $ret]);
Logger::info('cron_end');
break;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\DI;
-use Friendica\Network\HTTPRequest;
/**
* Sends updated profile data to the directory
Logger::log('Updating directory: ' . $arr['url'], Logger::DEBUG);
if (strlen($arr['url'])) {
- HTTPRequest::fetchUrl($dir . '?url=' . bin2hex($arr['url']));
+ DI::httpRequest()->fetchUrl($dir . '?url=' . bin2hex($arr['url']));
}
return;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
use Friendica\Model\GServer;
-use Friendica\Network\HTTPRequest;
use Friendica\Util\Strings;
class SearchDirectory
}
}
- $x = HTTPRequest::fetchUrl(Search::getGlobalDirectory() . '/lsearch?p=1&n=500&search=' . urlencode($search));
+ $x = DI::httpRequest()->fetchUrl(Search::getGlobalDirectory() . '/lsearch?p=1&n=500&search=' . urlencode($search));
$j = json_decode($x);
if (!empty($j->results)) {