Skip to content
Snippets Groups Projects
Commit 28c16e84 authored by Marc Egger's avatar Marc Egger
Browse files

minimal working version for Philipp

parent 2cd05c2a
No related branches found
No related tags found
2 merge requests!302Develop,!296Marc: Form/Report As File, Path class, Config class, Typo3 v9 compatability
Pipeline #3796 failed
......@@ -56,9 +56,19 @@ class RestClient {
$options['http']['content'] = $param[TOKEN_L_CONTENT];
}
$recvBuffer = self::callAPIMarc(strtoupper($param[TOKEN_L_METHOD]), $param[TOKEN_REST_CLIENT], $data = json_decode($param[TOKEN_L_CONTENT]));
// Marc Curl Version
try {
list($recv[HTTP_STATUS], $recvBuffer) = self::callAPIMarc(strtoupper($param[TOKEN_L_METHOD]),
$param[TOKEN_REST_CLIENT],
$data = json_decode($param[TOKEN_L_CONTENT]));
} catch (\Exception $e) {
$recv[HTTP_STATUS] = $e->getCode();
$recv[ERROR_MESSAGE] = $e->getMessage();
}
/*
// Carsten file_get_contents version
$context = stream_context_create($options);
try {
if (false === ($recvBuffer = file_get_contents($param[TOKEN_REST_CLIENT], false, $context))) {
......@@ -75,10 +85,12 @@ class RestClient {
$recv[HTTP_STATUS] = $e->getCode();
$recv[ERROR_MESSAGE] = $e->getMessage();
}
*/
// Copy new values to STORE_CLIENT
$this->store::setStore($recv, STORE_CLIENT, true);
*/
return $recvBuffer;
}
......@@ -178,7 +190,7 @@ class RestClient {
curl_setopt($ch, CURLOPT_HTTPHEADER, $curlHeader);
// send request
$output = json_decode(curl_exec($ch), true);
$output = curl_exec($ch);
if ($output === false) {
throw new Exception(curl_error($ch), curl_errno($ch));
......@@ -190,7 +202,7 @@ class RestClient {
// finished
curl_close($ch);
return $output;
return [$httpCode, $output];
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment