Rename "HTTPRequest::curl()" to HTTPRequest::get()
This commit is contained in:
parent
e5649d6dbf
commit
7029012f27
22 changed files with 66 additions and 64 deletions
|
@ -54,7 +54,7 @@ function ostatus_subscribe_content(App $a)
|
|||
$api = $contact['baseurl'] . '/api/';
|
||||
|
||||
// Fetching friends
|
||||
$curlResult = DI::httpRequest()->curl($api . 'statuses/friends.json?screen_name=' . $contact['nick']);
|
||||
$curlResult = DI::httpRequest()->get($api . 'statuses/friends.json?screen_name=' . $contact['nick']);
|
||||
|
||||
if (!$curlResult->isSuccess()) {
|
||||
DI::pConfig()->delete($uid, 'ostatus', 'legacy_contact');
|
||||
|
|
|
@ -28,6 +28,7 @@ use Friendica\Content\PageInfo;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\ParseUrl;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -84,7 +85,7 @@ function parse_url_content(App $a)
|
|||
// Check if the URL is an image, video or audio file. If so format
|
||||
// the URL with the corresponding BBCode media tag
|
||||
// Fetch the header of the URL
|
||||
$curlResponse = DI::httpRequest()->curl($url, false, ['novalidate' => true, 'nobody' => true]);
|
||||
$curlResponse = DI::httpRequest()->get($url, false, ['novalidate' => true, 'nobody' => true]);
|
||||
|
||||
if ($curlResponse->isSuccess()) {
|
||||
// Convert the header fields into an array
|
||||
|
|
|
@ -170,7 +170,7 @@ function redir_magic($a, $cid, $url)
|
|||
}
|
||||
|
||||
// Test for magic auth on the target system
|
||||
$serverret = DI::httpRequest()->curl($basepath . '/magic');
|
||||
$serverret = DI::httpRequest()->get($basepath . '/magic');
|
||||
if ($serverret->isSuccess()) {
|
||||
$separator = strpos($target_url, '?') ? '&' : '?';
|
||||
$target_url .= $separator . 'zrl=' . urlencode($visitor) . '&addr=' . urlencode($contact_url);
|
||||
|
|
|
@ -485,7 +485,7 @@ class BBCode
|
|||
continue;
|
||||
}
|
||||
|
||||
$curlResult = DI::httpRequest()->curl($mtch[1], true);
|
||||
$curlResult = DI::httpRequest()->get($mtch[1], true);
|
||||
if (!$curlResult->isSuccess()) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -284,7 +284,7 @@ class Search
|
|||
$return = GContact::searchByName($search, $mode);
|
||||
} else {
|
||||
$p = $page > 1 ? 'p=' . $page : '';
|
||||
$curlResult = DI::httpRequest()->curl(self::getGlobalDirectory() . '/search/people?' . $p . '&q=' . urlencode($search), false, ['accept_content' => 'application/json']);
|
||||
$curlResult = DI::httpRequest()->get(self::getGlobalDirectory() . '/search/people?' . $p . '&q=' . urlencode($search), false, ['accept_content' => 'application/json']);
|
||||
if ($curlResult->isSuccess()) {
|
||||
$searchResult = json_decode($curlResult->getBody(), true);
|
||||
if (!empty($searchResult['profiles'])) {
|
||||
|
|
|
@ -844,7 +844,7 @@ class GContact
|
|||
return false;
|
||||
}
|
||||
|
||||
$curlResult = DI::httpRequest()->curl($gserver['noscrape'] . '/' . $data['nick']);
|
||||
$curlResult = DI::httpRequest()->get($gserver['noscrape'] . '/' . $data['nick']);
|
||||
|
||||
if ($curlResult->isSuccess() && !empty($curlResult->getBody())) {
|
||||
$noscrape = json_decode($curlResult->getBody(), true);
|
||||
|
@ -926,7 +926,7 @@ class GContact
|
|||
private static function updateFromFeed(array $data)
|
||||
{
|
||||
// Search for the newest entry in the feed
|
||||
$curlResult = DI::httpRequest()->curl($data['poll']);
|
||||
$curlResult = DI::httpRequest()->get($data['poll']);
|
||||
if (!$curlResult->isSuccess()) {
|
||||
$fields = ['failed' => true, 'last_failure' => DateTimeFormat::utcNow()];
|
||||
DBA::update('gcontact', $fields, ['nurl' => Strings::normaliseLink($data['url'])]);
|
||||
|
@ -1204,7 +1204,7 @@ class GContact
|
|||
|
||||
$url = $server . '/main/statistics';
|
||||
|
||||
$curlResult = DI::httpRequest()->curl($url);
|
||||
$curlResult = DI::httpRequest()->get($url);
|
||||
if (!$curlResult->isSuccess()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -309,7 +309,7 @@ class GServer
|
|||
|
||||
// When a nodeinfo is present, we don't need to dig further
|
||||
$xrd_timeout = DI::config()->get('system', 'xrd_timeout');
|
||||
$curlResult = DI::httpRequest()->curl($url . '/.well-known/nodeinfo', false, ['timeout' => $xrd_timeout]);
|
||||
$curlResult = DI::httpRequest()->get($url . '/.well-known/nodeinfo', false, ['timeout' => $xrd_timeout]);
|
||||
if ($curlResult->isTimeout()) {
|
||||
self::setFailure($url);
|
||||
return false;
|
||||
|
@ -342,7 +342,7 @@ class GServer
|
|||
$basedata = ['detection-method' => self::DETECT_MANUAL];
|
||||
}
|
||||
|
||||
$curlResult = DI::httpRequest()->curl($baseurl, false, ['timeout' => $xrd_timeout]);
|
||||
$curlResult = DI::httpRequest()->get($baseurl, false, ['timeout' => $xrd_timeout]);
|
||||
if ($curlResult->isSuccess()) {
|
||||
$basedata = self::analyseRootHeader($curlResult, $basedata);
|
||||
$basedata = self::analyseRootBody($curlResult, $basedata, $baseurl);
|
||||
|
@ -498,7 +498,7 @@ class GServer
|
|||
{
|
||||
Logger::info('Discover relay data', ['server' => $server_url]);
|
||||
|
||||
$curlResult = DI::httpRequest()->curl($server_url . '/.well-known/x-social-relay');
|
||||
$curlResult = DI::httpRequest()->get($server_url . '/.well-known/x-social-relay');
|
||||
if (!$curlResult->isSuccess()) {
|
||||
return;
|
||||
}
|
||||
|
@ -579,7 +579,7 @@ class GServer
|
|||
*/
|
||||
private static function fetchStatistics(string $url)
|
||||
{
|
||||
$curlResult = DI::httpRequest()->curl($url . '/statistics.json');
|
||||
$curlResult = DI::httpRequest()->get($url . '/statistics.json');
|
||||
if (!$curlResult->isSuccess()) {
|
||||
return [];
|
||||
}
|
||||
|
@ -689,7 +689,7 @@ class GServer
|
|||
*/
|
||||
private static function parseNodeinfo1(string $nodeinfo_url)
|
||||
{
|
||||
$curlResult = DI::httpRequest()->curl($nodeinfo_url);
|
||||
$curlResult = DI::httpRequest()->get($nodeinfo_url);
|
||||
|
||||
if (!$curlResult->isSuccess()) {
|
||||
return [];
|
||||
|
@ -766,7 +766,7 @@ class GServer
|
|||
*/
|
||||
private static function parseNodeinfo2(string $nodeinfo_url)
|
||||
{
|
||||
$curlResult = DI::httpRequest()->curl($nodeinfo_url);
|
||||
$curlResult = DI::httpRequest()->get($nodeinfo_url);
|
||||
if (!$curlResult->isSuccess()) {
|
||||
return [];
|
||||
}
|
||||
|
@ -843,7 +843,7 @@ class GServer
|
|||
*/
|
||||
private static function fetchSiteinfo(string $url, array $serverdata)
|
||||
{
|
||||
$curlResult = DI::httpRequest()->curl($url . '/siteinfo.json');
|
||||
$curlResult = DI::httpRequest()->get($url . '/siteinfo.json');
|
||||
if (!$curlResult->isSuccess()) {
|
||||
return $serverdata;
|
||||
}
|
||||
|
@ -912,7 +912,7 @@ class GServer
|
|||
private static function validHostMeta(string $url)
|
||||
{
|
||||
$xrd_timeout = DI::config()->get('system', 'xrd_timeout');
|
||||
$curlResult = DI::httpRequest()->curl($url . '/.well-known/host-meta', false, ['timeout' => $xrd_timeout]);
|
||||
$curlResult = DI::httpRequest()->get($url . '/.well-known/host-meta', false, ['timeout' => $xrd_timeout]);
|
||||
if (!$curlResult->isSuccess()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1008,7 +1008,7 @@ class GServer
|
|||
{
|
||||
$serverdata['poco'] = '';
|
||||
|
||||
$curlResult = DI::httpRequest()->curl($url . '/poco');
|
||||
$curlResult = DI::httpRequest()->get($url . '/poco');
|
||||
if (!$curlResult->isSuccess()) {
|
||||
return $serverdata;
|
||||
}
|
||||
|
@ -1038,7 +1038,7 @@ class GServer
|
|||
*/
|
||||
public static function checkMastodonDirectory(string $url, array $serverdata)
|
||||
{
|
||||
$curlResult = DI::httpRequest()->curl($url . '/api/v1/directory?limit=1');
|
||||
$curlResult = DI::httpRequest()->get($url . '/api/v1/directory?limit=1');
|
||||
if (!$curlResult->isSuccess()) {
|
||||
return $serverdata;
|
||||
}
|
||||
|
@ -1065,7 +1065,7 @@ class GServer
|
|||
*/
|
||||
private static function detectNextcloud(string $url, array $serverdata)
|
||||
{
|
||||
$curlResult = DI::httpRequest()->curl($url . '/status.php');
|
||||
$curlResult = DI::httpRequest()->get($url . '/status.php');
|
||||
|
||||
if (!$curlResult->isSuccess() || ($curlResult->getBody() == '')) {
|
||||
return $serverdata;
|
||||
|
@ -1099,7 +1099,7 @@ class GServer
|
|||
*/
|
||||
private static function detectMastodonAlikes(string $url, array $serverdata)
|
||||
{
|
||||
$curlResult = DI::httpRequest()->curl($url . '/api/v1/instance');
|
||||
$curlResult = DI::httpRequest()->get($url . '/api/v1/instance');
|
||||
|
||||
if (!$curlResult->isSuccess() || ($curlResult->getBody() == '')) {
|
||||
return $serverdata;
|
||||
|
@ -1165,7 +1165,7 @@ class GServer
|
|||
*/
|
||||
private static function detectHubzilla(string $url, array $serverdata)
|
||||
{
|
||||
$curlResult = DI::httpRequest()->curl($url . '/api/statusnet/config.json');
|
||||
$curlResult = DI::httpRequest()->get($url . '/api/statusnet/config.json');
|
||||
if (!$curlResult->isSuccess() || ($curlResult->getBody() == '')) {
|
||||
return $serverdata;
|
||||
}
|
||||
|
@ -1263,7 +1263,7 @@ class GServer
|
|||
private static function detectGNUSocial(string $url, array $serverdata)
|
||||
{
|
||||
// Test for GNU Social
|
||||
$curlResult = DI::httpRequest()->curl($url . '/api/gnusocial/version.json');
|
||||
$curlResult = DI::httpRequest()->get($url . '/api/gnusocial/version.json');
|
||||
if ($curlResult->isSuccess() && ($curlResult->getBody() != '{"error":"not implemented"}') &&
|
||||
($curlResult->getBody() != '') && (strlen($curlResult->getBody()) < 30)) {
|
||||
$serverdata['platform'] = 'gnusocial';
|
||||
|
@ -1281,7 +1281,7 @@ class GServer
|
|||
}
|
||||
|
||||
// Test for Statusnet
|
||||
$curlResult = DI::httpRequest()->curl($url . '/api/statusnet/version.json');
|
||||
$curlResult = DI::httpRequest()->get($url . '/api/statusnet/version.json');
|
||||
if ($curlResult->isSuccess() && ($curlResult->getBody() != '{"error":"not implemented"}') &&
|
||||
($curlResult->getBody() != '') && (strlen($curlResult->getBody()) < 30)) {
|
||||
|
||||
|
@ -1317,9 +1317,9 @@ class GServer
|
|||
*/
|
||||
private static function detectFriendica(string $url, array $serverdata)
|
||||
{
|
||||
$curlResult = DI::httpRequest()->curl($url . '/friendica/json');
|
||||
$curlResult = DI::httpRequest()->get($url . '/friendica/json');
|
||||
if (!$curlResult->isSuccess()) {
|
||||
$curlResult = DI::httpRequest()->curl($url . '/friendika/json');
|
||||
$curlResult = DI::httpRequest()->get($url . '/friendika/json');
|
||||
$friendika = true;
|
||||
$platform = 'Friendika';
|
||||
} else {
|
||||
|
@ -1652,7 +1652,7 @@ class GServer
|
|||
if (!empty($accesstoken)) {
|
||||
$api = 'https://instances.social/api/1.0/instances/list?count=0';
|
||||
$header = ['Authorization: Bearer '.$accesstoken];
|
||||
$curlResult = DI::httpRequest()->curl($api, false, ['headers' => $header]);
|
||||
$curlResult = DI::httpRequest()->get($api, false, ['headers' => $header]);
|
||||
|
||||
if ($curlResult->isSuccess()) {
|
||||
$servers = json_decode($curlResult->getBody(), true);
|
||||
|
|
|
@ -420,7 +420,7 @@ class Photo
|
|||
|
||||
$filename = basename($image_url);
|
||||
if (!empty($image_url)) {
|
||||
$ret = DI::httpRequest()->curl($image_url, true);
|
||||
$ret = DI::httpRequest()->get($image_url, true);
|
||||
$img_str = $ret->getBody();
|
||||
$type = $ret->getContentType();
|
||||
} else {
|
||||
|
|
|
@ -737,7 +737,7 @@ class Profile
|
|||
$magic_path = $basepath . '/magic' . '?owa=1&dest=' . $dest . '&' . $addr_request;
|
||||
|
||||
// We have to check if the remote server does understand /magic without invoking something
|
||||
$serverret = DI::httpRequest()->curl($basepath . '/magic');
|
||||
$serverret = DI::httpRequest()->get($basepath . '/magic');
|
||||
if ($serverret->isSuccess()) {
|
||||
Logger::log('Doing magic auth for visitor ' . $my_url . ' to ' . $magic_path, Logger::DEBUG);
|
||||
System::externalRedirect($magic_path);
|
||||
|
|
|
@ -823,7 +823,7 @@ class User
|
|||
$photo_failure = false;
|
||||
|
||||
$filename = basename($photo);
|
||||
$curlResult = DI::httpRequest()->curl($photo, true);
|
||||
$curlResult = DI::httpRequest()->get($photo, true);
|
||||
if ($curlResult->isSuccess()) {
|
||||
$img_str = $curlResult->getBody();
|
||||
$type = $curlResult->getContentType();
|
||||
|
|
|
@ -246,7 +246,7 @@ class Summary extends BaseAdmin
|
|||
private static function checkSelfHostMeta()
|
||||
{
|
||||
// Fetch the host-meta to check if this really is a vital server
|
||||
return DI::httpRequest()->curl(DI::baseUrl()->get() . '/.well-known/host-meta')->isSuccess();
|
||||
return DI::httpRequest()->get(DI::baseUrl()->get() . '/.well-known/host-meta')->isSuccess();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ class Magic extends BaseModule
|
|||
);
|
||||
|
||||
// Try to get an authentication token from the other instance.
|
||||
$curlResult = DI::httpRequest()->curl($basepath . '/owa', false, ['headers' => $headers]);
|
||||
$curlResult = DI::httpRequest()->get($basepath . '/owa', false, ['headers' => $headers]);
|
||||
|
||||
if ($curlResult->isSuccess()) {
|
||||
$j = json_decode($curlResult->getBody(), true);
|
||||
|
|
|
@ -71,7 +71,7 @@ class HTTPRequest
|
|||
* @return CurlResult
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public function curl(string $url, bool $binary = false, array $opts = [], int &$redirects = 0)
|
||||
public function get(string $url, bool $binary = false, array $opts = [], int &$redirects = 0)
|
||||
{
|
||||
$stamp1 = microtime(true);
|
||||
|
||||
|
@ -206,7 +206,7 @@ class HTTPRequest
|
|||
$redirects++;
|
||||
$this->logger->notice('Curl redirect.', ['url' => $url, 'to' => $curlResponse->getRedirectUrl()]);
|
||||
@curl_close($ch);
|
||||
return $this->curl($curlResponse->getRedirectUrl(), $binary, $opts, $redirects);
|
||||
return $this->get($curlResponse->getRedirectUrl(), $binary, $opts, $redirects);
|
||||
}
|
||||
|
||||
@curl_close($ch);
|
||||
|
@ -486,7 +486,7 @@ class HTTPRequest
|
|||
*/
|
||||
public function fetchUrlFull(string $url, bool $binary = false, int $timeout = 0, string $accept_content = '', string $cookiejar = '', int &$redirects = 0)
|
||||
{
|
||||
return $this->curl(
|
||||
return $this->get(
|
||||
$url,
|
||||
$binary,
|
||||
[
|
||||
|
|
|
@ -166,7 +166,7 @@ class Probe
|
|||
Logger::info('Probing', ['host' => $host, 'ssl_url' => $ssl_url, 'url' => $url, 'callstack' => System::callstack(20)]);
|
||||
$xrd = null;
|
||||
|
||||
$curlResult = DI::httpRequest()->curl($ssl_url, false, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']);
|
||||
$curlResult = DI::httpRequest()->get($ssl_url, false, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']);
|
||||
$ssl_connection_error = ($curlResult->getErrorNumber() == CURLE_COULDNT_CONNECT) || ($curlResult->getReturnCode() == 0);
|
||||
if ($curlResult->isSuccess()) {
|
||||
$xml = $curlResult->getBody();
|
||||
|
@ -183,7 +183,7 @@ class Probe
|
|||
}
|
||||
|
||||
if (!is_object($xrd) && !empty($url)) {
|
||||
$curlResult = DI::httpRequest()->curl($url, false, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']);
|
||||
$curlResult = DI::httpRequest()->get($url, false, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']);
|
||||
$connection_error = ($curlResult->getErrorNumber() == CURLE_COULDNT_CONNECT) || ($curlResult->getReturnCode() == 0);
|
||||
if ($curlResult->isTimeout()) {
|
||||
Logger::info('Probing timeout', ['url' => $url]);
|
||||
|
@ -427,7 +427,7 @@ class Probe
|
|||
*/
|
||||
private static function getHideStatus($url)
|
||||
{
|
||||
$curlResult = DI::httpRequest()->curl($url);
|
||||
$curlResult = DI::httpRequest()->get($url);
|
||||
if (!$curlResult->isSuccess()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -841,7 +841,7 @@ class Probe
|
|||
|
||||
public static function pollZot($url, $data)
|
||||
{
|
||||
$curlResult = DI::httpRequest()->curl($url);
|
||||
$curlResult = DI::httpRequest()->get($url);
|
||||
if ($curlResult->isTimeout()) {
|
||||
return $data;
|
||||
}
|
||||
|
@ -938,7 +938,7 @@ class Probe
|
|||
{
|
||||
$xrd_timeout = DI::config()->get('system', 'xrd_timeout', 20);
|
||||
|
||||
$curlResult = DI::httpRequest()->curl($url, false, ['timeout' => $xrd_timeout, 'accept_content' => $type]);
|
||||
$curlResult = DI::httpRequest()->get($url, false, ['timeout' => $xrd_timeout, 'accept_content' => $type]);
|
||||
if ($curlResult->isTimeout()) {
|
||||
self::$istimeout = true;
|
||||
return [];
|
||||
|
@ -1007,7 +1007,7 @@ class Probe
|
|||
*/
|
||||
private static function pollNoscrape($noscrape_url, $data)
|
||||
{
|
||||
$curlResult = DI::httpRequest()->curl($noscrape_url);
|
||||
$curlResult = DI::httpRequest()->get($noscrape_url);
|
||||
if ($curlResult->isTimeout()) {
|
||||
self::$istimeout = true;
|
||||
return [];
|
||||
|
@ -1265,7 +1265,7 @@ class Probe
|
|||
*/
|
||||
private static function pollHcard($hcard_url, $data, $dfrn = false)
|
||||
{
|
||||
$curlResult = DI::httpRequest()->curl($hcard_url);
|
||||
$curlResult = DI::httpRequest()->get($hcard_url);
|
||||
if ($curlResult->isTimeout()) {
|
||||
self::$istimeout = true;
|
||||
return [];
|
||||
|
@ -1519,7 +1519,7 @@ class Probe
|
|||
$pubkey = substr($pubkey, 5);
|
||||
}
|
||||
} elseif (Strings::normaliseLink($pubkey) == 'http://') {
|
||||
$curlResult = DI::httpRequest()->curl($pubkey);
|
||||
$curlResult = DI::httpRequest()->get($pubkey);
|
||||
if ($curlResult->isTimeout()) {
|
||||
self::$istimeout = true;
|
||||
return $short ? false : [];
|
||||
|
@ -1552,7 +1552,7 @@ class Probe
|
|||
}
|
||||
|
||||
// Fetch all additional data from the feed
|
||||
$curlResult = DI::httpRequest()->curl($data["poll"]);
|
||||
$curlResult = DI::httpRequest()->get($data["poll"]);
|
||||
if ($curlResult->isTimeout()) {
|
||||
self::$istimeout = true;
|
||||
return [];
|
||||
|
@ -1604,7 +1604,7 @@ class Probe
|
|||
*/
|
||||
private static function pumpioProfileData($profile_link)
|
||||
{
|
||||
$curlResult = DI::httpRequest()->curl($profile_link);
|
||||
$curlResult = DI::httpRequest()->get($profile_link);
|
||||
if (!$curlResult->isSuccess()) {
|
||||
return [];
|
||||
}
|
||||
|
@ -1835,7 +1835,7 @@ class Probe
|
|||
*/
|
||||
private static function feed($url, $probe = true)
|
||||
{
|
||||
$curlResult = DI::httpRequest()->curl($url);
|
||||
$curlResult = DI::httpRequest()->get($url);
|
||||
if ($curlResult->isTimeout()) {
|
||||
self::$istimeout = true;
|
||||
return [];
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
namespace Friendica\Protocol;
|
||||
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\APContact;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Util\HTTPSignature;
|
||||
|
@ -92,7 +93,7 @@ class ActivityPub
|
|||
return HTTPSignature::fetch($url, $uid);
|
||||
}
|
||||
|
||||
$curlResult = DI::httpRequest()->curl($url, false, ['accept_content' => 'application/activity+json, application/ld+json']);
|
||||
$curlResult = DI::httpRequest()->get($url, false, ['accept_content' => 'application/activity+json, application/ld+json']);
|
||||
if (!$curlResult->isSuccess() || empty($curlResult->getBody())) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1194,7 +1194,7 @@ class DFRN
|
|||
|
||||
Logger::log('dfrn_deliver: ' . $url);
|
||||
|
||||
$curlResult = DI::httpRequest()->curl($url);
|
||||
$curlResult = DI::httpRequest()->get($url);
|
||||
|
||||
if ($curlResult->isTimeout()) {
|
||||
return -2; // timed out
|
||||
|
|
|
@ -755,7 +755,7 @@ class OStatus
|
|||
|
||||
self::$conv_list[$conversation] = true;
|
||||
|
||||
$curlResult = DI::httpRequest()->curl($conversation, false, ['accept_content' => 'application/atom+xml, text/html']);
|
||||
$curlResult = DI::httpRequest()->get($conversation, false, ['accept_content' => 'application/atom+xml, text/html']);
|
||||
|
||||
if (!$curlResult->isSuccess()) {
|
||||
return;
|
||||
|
@ -784,7 +784,7 @@ class OStatus
|
|||
}
|
||||
}
|
||||
if ($file != '') {
|
||||
$conversation_atom = DI::httpRequest()->curl($attribute['href']);
|
||||
$conversation_atom = DI::httpRequest()->get($attribute['href']);
|
||||
|
||||
if ($conversation_atom->isSuccess()) {
|
||||
$xml = $conversation_atom->getBody();
|
||||
|
@ -901,7 +901,7 @@ class OStatus
|
|||
return;
|
||||
}
|
||||
|
||||
$curlResult = DI::httpRequest()->curl($self);
|
||||
$curlResult = DI::httpRequest()->get($self);
|
||||
|
||||
if (!$curlResult->isSuccess()) {
|
||||
return;
|
||||
|
@ -948,7 +948,7 @@ class OStatus
|
|||
}
|
||||
|
||||
$stored = false;
|
||||
$curlResult = DI::httpRequest()->curl($related, false, ['accept_content' => 'application/atom+xml, text/html']);
|
||||
$curlResult = DI::httpRequest()->get($related, false, ['accept_content' => 'application/atom+xml, text/html']);
|
||||
|
||||
if (!$curlResult->isSuccess()) {
|
||||
return;
|
||||
|
@ -979,7 +979,7 @@ class OStatus
|
|||
}
|
||||
}
|
||||
if ($atom_file != '') {
|
||||
$curlResult = DI::httpRequest()->curl($atom_file);
|
||||
$curlResult = DI::httpRequest()->get($atom_file);
|
||||
|
||||
if ($curlResult->isSuccess()) {
|
||||
Logger::log('Fetched XML for URI ' . $related_uri, Logger::DEBUG);
|
||||
|
@ -991,7 +991,7 @@ class OStatus
|
|||
|
||||
// Workaround for older GNU Social servers
|
||||
if (($xml == '') && strstr($related, '/notice/')) {
|
||||
$curlResult = DI::httpRequest()->curl(str_replace('/notice/', '/api/statuses/show/', $related) . '.atom');
|
||||
$curlResult = DI::httpRequest()->get(str_replace('/notice/', '/api/statuses/show/', $related) . '.atom');
|
||||
|
||||
if ($curlResult->isSuccess()) {
|
||||
Logger::log('GNU Social workaround to fetch XML for URI ' . $related_uri, Logger::DEBUG);
|
||||
|
@ -1002,7 +1002,7 @@ class OStatus
|
|||
// Even more worse workaround for GNU Social ;-)
|
||||
if ($xml == '') {
|
||||
$related_guess = self::convertHref($related_uri);
|
||||
$curlResult = DI::httpRequest()->curl(str_replace('/notice/', '/api/statuses/show/', $related_guess) . '.atom');
|
||||
$curlResult = DI::httpRequest()->get(str_replace('/notice/', '/api/statuses/show/', $related_guess) . '.atom');
|
||||
|
||||
if ($curlResult->isSuccess()) {
|
||||
Logger::log('GNU Social workaround 2 to fetch XML for URI ' . $related_uri, Logger::DEBUG);
|
||||
|
|
|
@ -30,7 +30,6 @@ use Friendica\Database\DBA;
|
|||
use Friendica\DI;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\GServer;
|
||||
use Friendica\Network\HTTPRequest;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -251,7 +250,7 @@ class PortableContact
|
|||
*/
|
||||
private static function fetchServerlist($poco)
|
||||
{
|
||||
$curlResult = DI::httpRequest()->curl($poco . "/@server");
|
||||
$curlResult = DI::httpRequest()->get($poco . "/@server");
|
||||
|
||||
if (!$curlResult->isSuccess()) {
|
||||
return;
|
||||
|
@ -291,7 +290,7 @@ class PortableContact
|
|||
|
||||
Logger::info("Fetch all users from the server " . $server["url"]);
|
||||
|
||||
$curlResult = DI::httpRequest()->curl($url);
|
||||
$curlResult = DI::httpRequest()->get($url);
|
||||
|
||||
if ($curlResult->isSuccess() && !empty($curlResult->getBody())) {
|
||||
$data = json_decode($curlResult->getBody(), true);
|
||||
|
@ -314,7 +313,7 @@ class PortableContact
|
|||
|
||||
$success = false;
|
||||
|
||||
$curlResult = DI::httpRequest()->curl($url);
|
||||
$curlResult = DI::httpRequest()->get($url);
|
||||
|
||||
if ($curlResult->isSuccess() && !empty($curlResult->getBody())) {
|
||||
Logger::info("Fetch all global contacts from the server " . $server["nurl"]);
|
||||
|
@ -372,7 +371,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,contactType,generation';
|
||||
|
||||
$curlResult = DI::httpRequest()->curl($url);
|
||||
$curlResult = DI::httpRequest()->get($url);
|
||||
|
||||
if ($curlResult->isSuccess()) {
|
||||
$data = json_decode($curlResult->getBody(), true);
|
||||
|
|
|
@ -181,7 +181,7 @@ class ExAuth
|
|||
|
||||
$url = ($ssl ? 'https' : 'http') . '://' . $host . '/noscrape/' . $user;
|
||||
|
||||
$curlResult = DI::httpRequest()->curl($url);
|
||||
$curlResult = DI::httpRequest()->get($url);
|
||||
|
||||
if (!$curlResult->isSuccess()) {
|
||||
return false;
|
||||
|
|
|
@ -442,7 +442,7 @@ class HTTPSignature
|
|||
$curl_opts = $opts;
|
||||
$curl_opts['header'] = $headers;
|
||||
|
||||
$curlResult = DI::httpRequest()->curl($request, false, $curl_opts);
|
||||
$curlResult = DI::httpRequest()->get($request, false, $curl_opts);
|
||||
$return_code = $curlResult->getReturnCode();
|
||||
|
||||
Logger::log('Fetched for user ' . $uid . ' from ' . $request . ' returned ' . $return_code, Logger::DEBUG);
|
||||
|
|
|
@ -27,6 +27,7 @@ use Friendica\Content\OEmbed;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
||||
/**
|
||||
* Get information about a given URL
|
||||
|
@ -159,7 +160,7 @@ class ParseUrl
|
|||
return $siteinfo;
|
||||
}
|
||||
|
||||
$curlResult = DI::httpRequest()->curl($url);
|
||||
$curlResult = DI::httpRequest()->get($url);
|
||||
if (!$curlResult->isSuccess()) {
|
||||
return $siteinfo;
|
||||
}
|
||||
|
|
|
@ -290,7 +290,7 @@ class OnePoll
|
|||
. '&type=data&last_update=' . $last_update
|
||||
. '&perm=' . $perm;
|
||||
|
||||
$curlResult = DI::httpRequest()->curl($url);
|
||||
$curlResult = DI::httpRequest()->get($url);
|
||||
|
||||
if (!$curlResult->isSuccess() && ($curlResult->getErrorNumber() == CURLE_OPERATION_TIMEDOUT)) {
|
||||
// set the last-update so we don't keep polling
|
||||
|
@ -443,7 +443,7 @@ class OnePoll
|
|||
}
|
||||
|
||||
$cookiejar = tempnam(get_temppath(), 'cookiejar-onepoll-');
|
||||
$curlResult = DI::httpRequest()->curl($contact['poll'], false, ['cookiejar' => $cookiejar]);
|
||||
$curlResult = DI::httpRequest()->get($contact['poll'], false, ['cookiejar' => $cookiejar]);
|
||||
unlink($cookiejar);
|
||||
|
||||
if ($curlResult->isTimeout()) {
|
||||
|
|
Loading…
Reference in a new issue