<?php
/**
- * @copyright Copyright (C) 2010-2023, the Friendica project
+ * @copyright Copyright (C) 2010-2024, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
use Friendica\Protocol\Salmon;
use Friendica\Util\Crypto;
use Friendica\Util\DateTimeFormat;
+use Friendica\Util\HTTPSignature;
use Friendica\Util\Network;
use Friendica\Util\Strings;
use Friendica\Util\XML;
$curlResult = DI::httpClient()->get($ssl_url, HttpClientAccept::XRD_XML, [HttpClientOptions::TIMEOUT => $xrd_timeout]);
$ssl_connection_error = ($curlResult->getErrorNumber() == CURLE_COULDNT_CONNECT) || ($curlResult->getReturnCode() == 0);
if ($curlResult->isSuccess()) {
- $xml = $curlResult->getBody();
+ $xml = $curlResult->getBodyString();
$xrd = XML::parseString($xml, true);
if (!empty($url)) {
$host_url = 'https://' . $host;
return [];
}
- $xml = $curlResult->getBody();
+ $xml = $curlResult->getBodyString();
$xrd = XML::parseString($xml, true);
$host_url = 'http://'.$host;
}
if (!empty($data['baseurl']) && empty($data['gsid'])) {
$data['gsid'] = GServer::getID($data['baseurl']);
- }
+ }
// Ensure that local connections always are DFRN
if (($network == '') && ($data['network'] != Protocol::PHANTOM) && (self::ownHost($data['baseurl'] ?? '') || self::ownHost($data['url']))) {
return false;
}
- $body = $curlResult->getBody();
+ $body = $curlResult->getBodyString();
if (empty($body)) {
return false;
}
if ($curlResult->isTimeout()) {
return $data;
}
- $content = $curlResult->getBody();
+ $content = $curlResult->getBodyString();
if (!$content) {
return $data;
}
self::$isTimeout = true;
return [];
}
- $data = $curlResult->getBody();
+ $data = $curlResult->getBodyString();
$webfinger = json_decode($data, true);
if (!empty($webfinger)) {
self::$isTimeout = true;
return $data;
}
- $content = $curlResult->getBody();
+ $content = $curlResult->getBodyString();
if (!$content) {
Logger::info('Empty body', ['url' => $noscrape_url]);
return $data;
self::$isTimeout = true;
return [];
}
- $content = $curlResult->getBody();
+ $content = $curlResult->getBodyString();
if (empty($content)) {
return [];
}
return $short ? false : [];
}
Logger::debug('Fetched public key', ['Content-Type' => $curlResult->getHeader('Content-Type'), 'url' => $pubkey]);
- $pubkey = $curlResult->getBody();
+ $pubkey = $curlResult->getBodyString();
}
try {
self::$isTimeout = true;
return [];
}
- $feed = $curlResult->getBody();
+ $feed = $curlResult->getBodyString();
$feed_data = Feed::import($feed);
if (!$feed_data) {
return [];
private static function pumpioProfileData(string $profile_link, string $baseurl): array
{
$curlResult = DI::httpClient()->get($profile_link, HttpClientAccept::HTML);
- if (!$curlResult->isSuccess() || empty($curlResult->getBody())) {
+ if (!$curlResult->isSuccess() || empty($curlResult->getBodyString())) {
return [];
}
$doc = new DOMDocument();
- if (!@$doc->loadHTML($curlResult->getBody())) {
+ if (!@$doc->loadHTML($curlResult->getBodyString())) {
return [];
}
unset($baseParts['query']);
unset($baseParts['fragment']);
- return Network::unparseURL($baseParts);
+ return Network::unparseURL((array)$baseParts);
}
/**
return [];
}
- $feed = $curlResult->getBody();
+ $feed = $curlResult->getBodyString();
$feed_data = Feed::import($feed);
if (!$feed_data) {
$curlResult = DI::httpClient()->get($gserver['noscrape'] . '/' . $data['nick'], HttpClientAccept::JSON);
- if ($curlResult->isSuccess() && !empty($curlResult->getBody())) {
- $noscrape = json_decode($curlResult->getBody(), true);
+ if ($curlResult->isSuccess() && !empty($curlResult->getBodyString())) {
+ $noscrape = json_decode($curlResult->getBodyString(), true);
if (!empty($noscrape) && !empty($noscrape['updated'])) {
return DateTimeFormat::utc($noscrape['updated'], DateTimeFormat::MYSQL);
}
*/
private static function updateFromOutbox(string $feed, array $data): string
{
- $outbox = ActivityPub::fetchContent($feed);
+ $outbox = HTTPSignature::fetch($feed);
if (empty($outbox)) {
return '';
}
{
// Search for the newest entry in the feed
$curlResult = DI::httpClient()->get($data['poll'], HttpClientAccept::ATOM_XML);
- if (!$curlResult->isSuccess() || !$curlResult->getBody()) {
+ if (!$curlResult->isSuccess() || !$curlResult->getBodyString()) {
return '';
}
$doc = new DOMDocument();
- @$doc->loadXML($curlResult->getBody());
+ @$doc->loadXML($curlResult->getBodyString());
$xpath = new DOMXPath($doc);
$xpath->registerNamespace('atom', 'http://www.w3.org/2005/Atom');