42 if (empty($message->requestHeaders)) {
43 $message->requestHeaders = [
"Accept: */*"];
44 } elseif (count(preg_grep(
"/^Accept:/", $message->requestHeaders)) === 0) {
45 $message->requestHeaders[] =
"Accept: */*";
48 'method' => $message->getMethod(),
49 'content' => $message->request,
50 'header' => $message->requestHeaders,
51 'ignore_errors' =>
true,
54 $message->requestHeaders = implode(
"\n", $message->requestHeaders);
56 $ctx = stream_context_create([
'http' => $opts]);
57 $fp = @fopen($message->getUrl(),
'rb',
false, $ctx);
59 $resp = @stream_get_contents($fp);
60 $message->ok =
$resp !==
false;
62 $message->response =
$resp;
64 if (isset($http_response_header[0])) {
65 $message->responseHeaders = trim(implode(
"\n", $http_response_header));
66 if (preg_match(
"/HTTP\/\d.\d\s+(\d+)/", $http_response_header[0],
$out)) {
67 $message->status =
$out[1];
69 $message->ok = $message->status < 400;
71 $message->error = $http_response_header[0];
78 $message->error = $e->getMessage();
82 $message->error = error_get_last()[
"message"];
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...