mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-17 02:45:16 +02:00
Merge pull request #8911 from MrPetovan/task/curl_DI
Introduce "HTTPRequest" class
This commit is contained in:
commit
398e65d66b
51 changed files with 765 additions and 647 deletions
|
@ -45,7 +45,6 @@ use Friendica\Model\User;
|
|||
use Friendica\Protocol\Activity;
|
||||
use Friendica\Util\Crypto;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
|
@ -224,7 +223,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
*
|
||||
*/
|
||||
|
||||
$res = Network::post($dfrn_confirm, $params, [], 120)->getBody();
|
||||
$res = DI::httpRequest()->post($dfrn_confirm, $params, [], 120)->getBody();
|
||||
|
||||
Logger::log(' Confirm: received data: ' . $res, Logger::DATA);
|
||||
|
||||
|
|
|
@ -21,13 +21,12 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Protocol\DFRN;
|
||||
use Friendica\Protocol\OStatus;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
|
@ -115,7 +114,7 @@ function dfrn_poll_init(App $a)
|
|||
);
|
||||
|
||||
if (DBA::isResult($r)) {
|
||||
$s = Network::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);
|
||||
|
||||
|
@ -499,20 +498,20 @@ function dfrn_poll_content(App $a)
|
|||
|
||||
// URL reply
|
||||
if ($dfrn_version < 2.2) {
|
||||
$s = Network::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 = Network::post($r[0]['poll'], [
|
||||
'dfrn_id' => $encrypted_id,
|
||||
'type' => 'profile-check',
|
||||
$s = DI::httpRequest()->post($r[0]['poll'], [
|
||||
'dfrn_id' => $encrypted_id,
|
||||
'type' => 'profile-check',
|
||||
'dfrn_version' => DFRN_PROTOCOL_VERSION,
|
||||
'challenge' => $challenge,
|
||||
'sec' => $sec
|
||||
'challenge' => $challenge,
|
||||
'sec' => $sec
|
||||
])->getBody();
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@ use Friendica\Core\Logger;
|
|||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Search;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -203,7 +203,7 @@ function dfrn_request_post(App $a)
|
|||
}
|
||||
|
||||
if (!empty($dfrn_request) && strlen($confirm_key)) {
|
||||
Network::fetchUrl($dfrn_request . '?confirm_key=' . $confirm_key);
|
||||
DI::httpRequest()->fetch($dfrn_request . '?confirm_key=' . $confirm_key);
|
||||
}
|
||||
|
||||
// (ignore reply, nothing we can do it failed)
|
||||
|
|
|
@ -27,7 +27,6 @@ use Friendica\Database\DBA;
|
|||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Proxy as ProxyUtils;
|
||||
|
||||
/**
|
||||
|
@ -76,7 +75,7 @@ function match_content(App $a)
|
|||
$host = DI::baseUrl();
|
||||
}
|
||||
|
||||
$msearch_json = Network::post($host . '/msearch', $params)->getBody();
|
||||
$msearch_json = DI::httpRequest()->post($host . '/msearch', $params)->getBody();
|
||||
|
||||
$msearch = json_decode($msearch_json);
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ use Friendica\App;
|
|||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\Security\Login;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
function oexchange_init(App $a) {
|
||||
|
@ -57,7 +56,7 @@ function oexchange_content(App $a) {
|
|||
$tags = ((!empty($_REQUEST['tags']))
|
||||
? '&tags=' . urlencode(Strings::escapeTags(trim($_REQUEST['tags']))) : '');
|
||||
|
||||
$s = Network::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;
|
||||
|
|
|
@ -23,7 +23,6 @@ use Friendica\App;
|
|||
use Friendica\Core\Protocol;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Util\Network;
|
||||
|
||||
function ostatus_subscribe_content(App $a)
|
||||
{
|
||||
|
@ -55,7 +54,7 @@ function ostatus_subscribe_content(App $a)
|
|||
$api = $contact['baseurl'] . '/api/';
|
||||
|
||||
// Fetching friends
|
||||
$curlResult = Network::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,7 +28,7 @@ use Friendica\Content\PageInfo;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\ParseUrl;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -85,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 = Network::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
|
||||
|
|
|
@ -24,7 +24,6 @@ use Friendica\Core\Logger;
|
|||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\PushSubscriber;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
function post_var($name) {
|
||||
|
@ -126,7 +125,7 @@ function pubsubhubbub_init(App $a) {
|
|||
$hub_callback = rtrim($hub_callback, ' ?&#');
|
||||
$separator = parse_url($hub_callback, PHP_URL_QUERY) === null ? '?' : '&';
|
||||
|
||||
$fetchResult = Network::fetchUrlFull($hub_callback . $separator . $params);
|
||||
$fetchResult = DI::httpRequest()->fetchFull($hub_callback . $separator . $params);
|
||||
$body = $fetchResult->getBody();
|
||||
$ret = $fetchResult->getReturnCode();
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ use Friendica\Database\DBA;
|
|||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
function redir_init(App $a) {
|
||||
|
@ -171,7 +170,7 @@ function redir_magic($a, $cid, $url)
|
|||
}
|
||||
|
||||
// Test for magic auth on the target system
|
||||
$serverret = Network::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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue