19 declare(strict_types=1);
34 $this->
logger->info(__METHOD__ .
': Add new course url ...');
36 $this->path_postfix =
'/campusconnect/course_urls';
41 $this->
addHeader(
'Content-Type',
'application/json');
42 $this->
addHeader(
'Accept',
'application/json');
45 $this->curl->setOpt(CURLOPT_HTTPHEADER, $this->
getHeader());
46 $this->curl->setOpt(CURLOPT_POST,
true);
47 $this->curl->setOpt(CURLOPT_POSTFIELDS, json_encode($url, JSON_THROW_ON_ERROR));
49 $this->
logger->debug(
'Sending url ' . print_r(json_encode($url, JSON_THROW_ON_ERROR),
true));
53 $info = $this->curl->getInfo(CURLINFO_HTTP_CODE);
55 $this->
logger->debug(
'Checking HTTP status...');
56 if ($info !== self::HTTP_CODE_CREATED) {
57 $this->
logger->debug(
'Cannot create course url ressource, did not receive HTTP 201. ');
58 $this->
logger->debug(
'POST was: ' . json_encode($url, JSON_THROW_ON_ERROR));
59 $this->
logger->debug(
'HTTP code: ' . $info);
62 $this->
logger->debug(
'... got HTTP 201 (created)');
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addUrl(ilECSCourseUrl $url, $a_target_mid)
Send url of newly created courses to ecs.
addHeader(string $a_name, string $a_value)
Add Header.
Connector for writing ecs course urls.
Represents a ecs course url.
prepareConnection()
prepare connection