DBA::update('contact', ['hub-verify' => $verify_token], ['id' => $contact['id']]);
}
- Network::post($url, $params);
+ $postResult = Network::post($url, $params);
- logger('subscribe_to_hub: returns: ' . Network::getCurl()->getCode(), LOGGER_DEBUG);
+ logger('subscribe_to_hub: returns: ' . $postResult->getReturnCode(), LOGGER_DEBUG);
return;
*
*/
- $res = Network::post($dfrn_confirm, $params, null, $redirects, 120);
+ $res = Network::post($dfrn_confirm, $params, null, $redirects, 120)->getBody();
logger(' Confirm: received data: ' . $res, LOGGER_DATA);
'dfrn_version' => DFRN_PROTOCOL_VERSION,
'challenge' => $challenge,
'sec' => $sec
- ]);
+ ])->getBody();
}
$profile = ((DBA::isResult($r) && $r[0]['nickname']) ? $r[0]['nickname'] : $nickname);
}
if (strlen(Config::get('system', 'directory'))) {
- $x = Network::post(get_server().'/msearch', $params);
+ $x = Network::post(get_server().'/msearch', $params)->getBody();
} else {
- $x = Network::post(System::baseUrl() . '/msearch', $params);
+ $x = Network::post(System::baseUrl() . '/msearch', $params)->getBody();
}
$j = json_decode($x);
$content_type = ($public_batch ? "application/magic-envelope+xml" : "application/json");
- $xml = Network::post($dest_url, $envelope, ["Content-Type: ".$content_type]);
+ $postResult = Network::post($dest_url, $envelope, ["Content-Type: ".$content_type]);
+ $xml = $postResult->getBody();
- $curl_stat = Network::getCurl()->getCode();
+ $curl_stat = $postResult->getReturnCode();
if (empty($curl_stat) || empty($xml)) {
logger('Empty answer from ' . $contact['id'] . ' - ' . $dest_url);
Contact::markForArchival($contact);
return -9; // timed out
}
- if (($curl_stat == 503) && (stristr(Network::getCurl()->getHeaders(), 'retry-after'))) {
+ if (($curl_stat == 503) && (stristr($postResult->getHeader(), 'retry-after'))) {
Contact::markForArchival($contact);
return -10;
}
if (!intval(Config::get("system", "diaspora_test"))) {
$content_type = (($public_batch) ? "application/magic-envelope+xml" : "application/json");
- Network::post($dest_url."/", $envelope, ["Content-Type: ".$content_type]);
- $return_code = Network::getCurl()->getCode();
+ $postResult = Network::post($dest_url."/", $envelope, ["Content-Type: ".$content_type]);
+ $return_code = $postResult->getReturnCode();
} else {
logger("test_mode");
return 200;
logger("transmit: ".$logid."-".$guid." to ".$dest_url." returns: ".$return_code);
- if (!$return_code || (($return_code == 503) && (stristr(Network::getCurl()->getHeaders(), "retry-after")))) {
+ if (!$return_code || (($return_code == 503) && (stristr($postResult->getHeaders(), "retry-after")))) {
if (!$no_queue && !empty($contact['contact-type']) && ($contact['contact-type'] != Contact::ACCOUNT_TYPE_RELAY)) {
logger("queue message");
// queue message for redelivery
$salmon = XML::fromArray($xmldata, $xml, false, $namespaces);
// slap them
- Network::post($url, $salmon, [
+ $postResult = Network::post($url, $salmon, [
'Content-type: application/magic-envelope+xml',
'Content-length: ' . strlen($salmon)
]);
- $a = get_app();
- $return_code = Network::getCurl()->getCode();
+ $return_code = $postResult->getReturnCode();
// check for success, e.g. 2xx
$salmon = XML::fromArray($xmldata, $xml, false, $namespaces);
// slap them
- Network::post($url, $salmon, [
+ $postResult = Network::post($url, $salmon, [
'Content-type: application/magic-envelope+xml',
'Content-length: ' . strlen($salmon)
]);
- $return_code = Network::getCurl()->getCode();
+ $return_code = $postResult->getReturnCode();
}
if ($return_code > 299) {
$salmon = XML::fromArray($xmldata, $xml, false, $namespaces);
// slap them
- Network::post($url, $salmon, [
+ $postResult = Network::post($url, $salmon, [
'Content-type: application/magic-envelope+xml',
'Content-length: ' . strlen($salmon)]);
- $return_code = Network::getCurl()->getCode();
+ $return_code = $postResult->getReturnCode();
}
logger('slapper for '.$url.' returned ' . $return_code);
$headers[] = 'Content-Type: application/activity+json';
- Network::post($target, $content, $headers);
- $return_code = Network::getCurl()->getCode();
+ $postResult = Network::post($target, $content, $headers);
- logger('Transmit to ' . $target . ' returned ' . $return_code);
+ logger('Transmit to ' . $target . ' returned ' . $postResult->getReturnCode());
}
/**
$postvars['dfrn_version'] = DFRN_PROTOCOL_VERSION;
$postvars['perm'] = 'rw';
- $xml = Network::post($contact['poll'], $postvars);
+ $xml = Network::post($contact['poll'], $postvars)->getBody();
} elseif (($contact['network'] === Protocol::OSTATUS)
|| ($contact['network'] === Protocol::DIASPORA)
logger('POST ' . print_r($headers, true) . "\n" . $params, LOGGER_DATA);
- Network::post($subscriber['callback_url'], $params, $headers);
- $ret = Network::getCurl()->getCode();
+ $postResult = Network::post($subscriber['callback_url'], $params, $headers);
+ $ret = $postResult->getReturnCode();
$condition = ['id' => $subscriber['id']];