Curl Response Refactoring
- extended Curl to parse Curl Response - refactored Network::curl() - replaced every Network::curl() execution with the new Curl container
This commit is contained in:
parent
904fee3bed
commit
2dec8895a9
20 changed files with 466 additions and 382 deletions
|
@ -33,12 +33,12 @@ class APContact extends BaseObject
|
|||
|
||||
$webfinger = 'https://' . $addr_parts[1] . '/.well-known/webfinger?resource=acct:' . urlencode($addr);
|
||||
|
||||
$ret = Network::curl($webfinger, false, $redirects, ['accept_content' => 'application/jrd+json,application/json']);
|
||||
if (!$ret['success'] || empty($ret['body'])) {
|
||||
$curlResult = Network::curl($webfinger, false, $redirects, ['accept_content' => 'application/jrd+json,application/json']);
|
||||
if (!$curlResult->isSuccess() || empty($curlResult->getBody())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$data = json_decode($ret['body'], true);
|
||||
$data = json_decode($curlResult->getBody(), true);
|
||||
|
||||
if (empty($data['links'])) {
|
||||
return false;
|
||||
|
|
|
@ -957,12 +957,12 @@ class GContact
|
|||
|
||||
$url = $server."/main/statistics";
|
||||
|
||||
$result = Network::curl($url);
|
||||
if (!$result["success"]) {
|
||||
$curlResult = Network::curl($url);
|
||||
if (!$curlResult->isSuccess()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$statistics = json_decode($result["body"]);
|
||||
$statistics = json_decode($curlResult->getBody());
|
||||
|
||||
if (!empty($statistics->config)) {
|
||||
if ($statistics->config->instance_with_ssl) {
|
||||
|
|
|
@ -1056,7 +1056,7 @@ class Profile
|
|||
if ($basepath != System::baseUrl() && !strstr($dest, '/magic') && !strstr($dest, '/rmagic')) {
|
||||
$magic_path = $basepath . '/magic' . '?f=&owa=1&dest=' . $dest;
|
||||
$serverret = Network::curl($magic_path);
|
||||
if (!empty($serverret['success'])) {
|
||||
if ($serverret->isSuccess()) {
|
||||
goaway($magic_path);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue