Curl Response Refactoring

- refactored Network::post()
- replaced every Network::post() execution with the new Curl container
This commit is contained in:
Philipp Holzer 2018-10-10 21:15:26 +02:00
parent 2dec8895a9
commit 7c73e8634c
No known key found for this signature in database
GPG key ID: 517BE60E2CE5C8A5
10 changed files with 24 additions and 25 deletions

View file

@ -133,13 +133,12 @@ class Salmon
$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
@ -159,11 +158,11 @@ class Salmon
$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) {
@ -182,10 +181,10 @@ class Salmon
$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);