mirror of
https://github.com/friendica/friendica
synced 2025-04-27 05:50:10 +00:00
Move post/curl/fetchUrl/fetchUrlFull to own class "Network\HTTPRequest"
This commit is contained in:
parent
2889d59b83
commit
5344efef71
43 changed files with 528 additions and 485 deletions
|
@ -31,6 +31,7 @@ use Friendica\Core\Hook;
|
|||
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;
|
||||
|
@ -95,7 +96,7 @@ class OEmbed
|
|||
|
||||
if (!in_array($ext, $noexts)) {
|
||||
// try oembed autodiscovery
|
||||
$html_text = Network::fetchUrl($embedurl, false, 15, 'text/*');
|
||||
$html_text = HTTPRequest::fetchUrl($embedurl, false, 15, 'text/*');
|
||||
if ($html_text) {
|
||||
$dom = @DOMDocument::loadHTML($html_text);
|
||||
if ($dom) {
|
||||
|
@ -103,14 +104,14 @@ class OEmbed
|
|||
$entries = $xpath->query("//link[@type='application/json+oembed']");
|
||||
foreach ($entries as $e) {
|
||||
$href = $e->getAttributeNode('href')->nodeValue;
|
||||
$json_string = Network::fetchUrl($href . '&maxwidth=' . $a->videowidth);
|
||||
$json_string = 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 = Network::fetchUrl($href . '&maxwidth=' . $a->videowidth);
|
||||
$json_string = HTTPRequest::fetchUrl($href . '&maxwidth=' . $a->videowidth);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,12 +38,11 @@ use Friendica\Model\Contact;
|
|||
use Friendica\Model\Event;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Model\Tag;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Network\HTTPRequest;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Protocol\Activity;
|
||||
use Friendica\Util\Images;
|
||||
use Friendica\Util\Map;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\ParseUrl;
|
||||
use Friendica\Util\Proxy as ProxyUtils;
|
||||
use Friendica\Util\Strings;
|
||||
|
@ -487,7 +486,7 @@ class BBCode
|
|||
continue;
|
||||
}
|
||||
|
||||
$curlResult = Network::curl($mtch[1], true);
|
||||
$curlResult = HTTPRequest::curl($mtch[1], true);
|
||||
if (!$curlResult->isSuccess()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1108,7 +1107,7 @@ class BBCode
|
|||
$text = "[url=" . $match[2] . ']' . $match[2] . "[/url]";
|
||||
|
||||
// if its not a picture then look if its a page that contains a picture link
|
||||
$body = Network::fetchUrl($match[1]);
|
||||
$body = HTTPRequest::fetchUrl($match[1]);
|
||||
|
||||
$doc = new DOMDocument();
|
||||
@$doc->loadHTML($body);
|
||||
|
@ -1187,7 +1186,7 @@ class BBCode
|
|||
}
|
||||
|
||||
// if its not a picture then look if its a page that contains a picture link
|
||||
$body = Network::fetchUrl($match[1]);
|
||||
$body = HTTPRequest::fetchUrl($match[1]);
|
||||
|
||||
$doc = new DOMDocument();
|
||||
@$doc->loadHTML($body);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue