);
if (DBA::isResult($r)) {
- $s = DI::httpRequest()->fetchUrl($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check');
+ $s = DI::httpRequest()->fetch($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 = DI::httpRequest()->fetchUrl($r[0]['poll']
- . '?dfrn_id=' . $encrypted_id
- . '&type=profile-check'
- . '&dfrn_version=' . DFRN_PROTOCOL_VERSION
- . '&challenge=' . $challenge
- . '&sec=' . $sec
+ $s = DI::httpRequest()->fetch($r[0]['poll']
+ . '?dfrn_id=' . $encrypted_id
+ . '&type=profile-check'
+ . '&dfrn_version=' . DFRN_PROTOCOL_VERSION
+ . '&challenge=' . $challenge
+ . '&sec=' . $sec
);
} else {
$s = DI::httpRequest()->post($r[0]['poll'], [
}
if (!empty($dfrn_request) && strlen($confirm_key)) {
- DI::httpRequest()->fetchUrl($dfrn_request . '?confirm_key=' . $confirm_key);
+ DI::httpRequest()->fetch($dfrn_request . '?confirm_key=' . $confirm_key);
}
// (ignore reply, nothing we can do it failed)
$tags = ((!empty($_REQUEST['tags']))
? '&tags=' . urlencode(Strings::escapeTags(trim($_REQUEST['tags']))) : '');
- $s = DI::httpRequest()->fetchUrl(DI::baseUrl() . '/parse_url?url=' . $url . $title . $description . $tags);
+ $s = DI::httpRequest()->fetch(DI::baseUrl() . '/parse_url?url=' . $url . $title . $description . $tags);
if (!strlen($s)) {
return;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\PushSubscriber;
-use Friendica\Network\HTTPRequest;
use Friendica\Util\Strings;
function post_var($name) {
$hub_callback = rtrim($hub_callback, ' ?&#');
$separator = parse_url($hub_callback, PHP_URL_QUERY) === null ? '?' : '&';
- $fetchResult = DI::httpRequest()->fetchUrlFull($hub_callback . $separator . $params);
+ $fetchResult = DI::httpRequest()->fetchFull($hub_callback . $separator . $params);
$body = $fetchResult->getBody();
$ret = $fetchResult->getReturnCode();
if (!in_array($ext, $noexts)) {
// try oembed autodiscovery
- $html_text = DI::httpRequest()->fetchUrl($embedurl, false, 15, 'text/*');
+ $html_text = DI::httpRequest()->fetch($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 = DI::httpRequest()->fetchUrl($href . '&maxwidth=' . $a->videowidth);
+ $json_string = DI::httpRequest()->fetch($href . '&maxwidth=' . $a->videowidth);
break;
}
$entries = $xpath->query("//link[@type='text/json+oembed']");
foreach ($entries as $e) {
$href = $e->getAttributeNode('href')->nodeValue;
- $json_string = DI::httpRequest()->fetchUrl($href . '&maxwidth=' . $a->videowidth);
+ $json_string = DI::httpRequest()->fetch($href . '&maxwidth=' . $a->videowidth);
break;
}
}
$text = "[url=" . $match[2] . ']' . $match[2] . "[/url]";
// if its not a picture then look if its a page that contains a picture link
- $body = DI::httpRequest()->fetchUrl($match[1]);
+ $body = DI::httpRequest()->fetch($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 = DI::httpRequest()->fetchUrl($match[1]);
+ $body = DI::httpRequest()->fetch($match[1]);
$doc = new DOMDocument();
@$doc->loadHTML($body);
use Friendica\Database\Database;
use Friendica\Database\DBStructure;
use Friendica\DI;
-use Friendica\Network\HTTPRequest;
use Friendica\Util\Images;
use Friendica\Util\Strings;
$help = "";
$error_msg = "";
if (function_exists('curl_init')) {
- $fetchResult = DI::httpRequest()->fetchUrlFull($baseurl . "/install/testrewrite");
+ $fetchResult = DI::httpRequest()->fetchFull($baseurl . "/install/testrewrite");
$url = Strings::normaliseLink($baseurl . "/install/testrewrite");
if ($fetchResult->getReturnCode() != 204) {
- $fetchResult = DI::httpRequest()->fetchUrlFull($url);
+ $fetchResult = DI::httpRequest()->fetchFull($url);
}
if ($fetchResult->getReturnCode() != 204) {
$searchUrl .= '&page=' . $page;
}
- $resultJson = DI::httpRequest()->fetchUrl($searchUrl, false, 0, 'application/json');
+ $resultJson = DI::httpRequest()->fetch($searchUrl, false, 0, 'application/json');
$results = json_decode($resultJson, true);
}
$url = DI::baseUrl() . '/worker';
- DI::httpRequest()->fetchUrl($url, false, 1);
+ DI::httpRequest()->fetch($url, false, 1);
}
/**
$done[] = DI::baseUrl() . '/poco';
if (strlen(DI::config()->get('system', 'directory'))) {
- $x = DI::httpRequest()->fetchUrl(Search::getGlobalDirectory() . '/pubsites');
+ $x = DI::httpRequest()->fetch(Search::getGlobalDirectory() . '/pubsites');
if (!empty($x)) {
$j = json_decode($x);
if (!empty($j->entries)) {
$protocols = ['activitypub', 'diaspora', 'dfrn', 'ostatus'];
foreach ($protocols as $protocol) {
$query = '{nodes(protocol:"' . $protocol . '"){host}}';
- $curlResult = DI::httpRequest()->fetchUrl('https://the-federation.info/graphql?query=' . urlencode($query));
+ $curlResult = DI::httpRequest()->fetch('https://the-federation.info/graphql?query=' . urlencode($query));
if (!empty($curlResult)) {
$data = json_decode($curlResult, true);
if (!empty($data['data']['nodes'])) {
$contact = Model\Contact::getByURLForUser($url, local_user(), false);
- $xml = DI::httpRequest()->fetchUrl($contact['poll']);
+ $xml = DI::httpRequest()->fetch($contact['poll']);
$import_result = Protocol\Feed::import($xml);
* @return string The fetched content
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function fetchUrl(string $url, bool $binary = false, int $timeout = 0, string $accept_content = '', string $cookiejar = '', int &$redirects = 0)
+ public function fetch(string $url, bool $binary = false, int $timeout = 0, string $accept_content = '', string $cookiejar = '', int &$redirects = 0)
{
- $ret = $this->fetchUrlFull($url, $binary, $timeout, $accept_content, $cookiejar, $redirects);
+ $ret = $this->fetchFull($url, $binary, $timeout, $accept_content, $cookiejar, $redirects);
return $ret->getBody();
}
* @return CurlResult With all relevant information, 'body' contains the actual fetched content.
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function fetchUrlFull(string $url, bool $binary = false, int $timeout = 0, string $accept_content = '', string $cookiejar = '', int &$redirects = 0)
+ public function fetchFull(string $url, bool $binary = false, int $timeout = 0, string $accept_content = '', string $cookiejar = '', int &$redirects = 0)
{
return $this->get(
$url,
Logger::log("Fetch post from ".$source_url, Logger::DEBUG);
- $envelope = DI::httpRequest()->fetchUrl($source_url);
+ $envelope = DI::httpRequest()->fetch($source_url);
if ($envelope) {
Logger::log("Envelope was fetched.", Logger::DEBUG);
$x = self::verifyMagicEnvelope($envelope);
Logger::log('load: ' . $url, Logger::DEBUG);
- $fetchresult = DI::httpRequest()->fetchUrlFull($url);
+ $fetchresult = DI::httpRequest()->fetchFull($url);
$s = $fetchresult->getBody();
Logger::log('load: returns ' . $s, Logger::DATA);
return $data;
}
- $img_str = DI::httpRequest()->fetchUrl($url, true, 4);
+ $img_str = DI::httpRequest()->fetch($url, true, 4);
if (!$img_str) {
return [];
Logger::log("Checking VERSION from: ".$checked_url, Logger::DEBUG);
// fetch the VERSION file
- $gitversion = DBA::escape(trim(DI::httpRequest()->fetchUrl($checked_url)));
+ $gitversion = DBA::escape(trim(DI::httpRequest()->fetch($checked_url)));
Logger::log("Upstream VERSION is: ".$gitversion, Logger::DEBUG);
DI::config()->set('system', 'git_friendica_version', $gitversion);
// Now trying to register
$url = 'http://the-federation.info/register/' . DI::baseUrl()->getHostname();
Logger::debug('Check registering url', ['url' => $url]);
- $ret = DI::httpRequest()->fetchUrl($url);
+ $ret = DI::httpRequest()->fetch($url);
Logger::debug('Check registering answer', ['answer' => $ret]);
Logger::info('cron_end');
break;
Logger::log('Updating directory: ' . $arr['url'], Logger::DEBUG);
if (strlen($arr['url'])) {
- DI::httpRequest()->fetchUrl($dir . '?url=' . bin2hex($arr['url']));
+ DI::httpRequest()->fetch($dir . '?url=' . bin2hex($arr['url']));
}
return;
}
}
- $x = DI::httpRequest()->fetchUrl(Search::getGlobalDirectory() . '/lsearch?p=1&n=500&search=' . urlencode($search));
+ $x = DI::httpRequest()->fetch(Search::getGlobalDirectory() . '/lsearch?p=1&n=500&search=' . urlencode($search));
$j = json_decode($x);
if (!empty($j->results)) {